diff --git a/gradle.properties b/gradle.properties index cca72a5..2def85b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ minecraft_version=1.18.2 yarn_mappings=1.18.2+build.1 loader_version=0.13.3 # Mod Properties -mod_version=0.1.9 +mod_version=0.1.10 maven_group=com.glisco archives_base_name=interactic # Dependencies diff --git a/src/main/java/interactic/InteracticInit.java b/src/main/java/interactic/InteracticInit.java index a0080ea..04e5c3a 100644 --- a/src/main/java/interactic/InteracticInit.java +++ b/src/main/java/interactic/InteracticInit.java @@ -19,7 +19,7 @@ public class InteracticInit implements ModInitializer { public static final String MOD_ID = "interactic"; - public static final Item ITEM_FILTER = new ItemFilterItem(); + private static Item ITEM_FILTER = null; private static InteracticConfig CONFIG; private static float itemRotationSpeedMultiplier = 1f; @@ -39,7 +39,7 @@ public void onInitialize() { if (FabricLoader.getInstance().isModLoaded("iris")) itemRotationSpeedMultiplier = 0.5f; if (CONFIG.itemFilterEnabled) { - Registry.register(Registry.ITEM, new Identifier(MOD_ID, "item_filter"), ITEM_FILTER); + ITEM_FILTER = Registry.register(Registry.ITEM, new Identifier(MOD_ID, "item_filter"), new ItemFilterItem()); ServerPlayNetworking.registerGlobalReceiver(new Identifier(MOD_ID, "filter_mode_request"), (server, player, handler, buf, responseSender) -> { final boolean newMode = buf.readBoolean(); @@ -76,6 +76,10 @@ public void onInitialize() { } } + public static Item getItemFilter() { + return ITEM_FILTER; + } + private void dropSelected(PlayerEntity player, boolean dropAll) { player.dropItem(player.getInventory().removeStack(player.getInventory().selectedSlot, dropAll && !player.getInventory().getMainHandStack().isEmpty() ? player.getInventory().getMainHandStack().getCount() : 1), false, true); } diff --git a/src/main/java/interactic/mixin/ItemEntityRendererMixin.java b/src/main/java/interactic/mixin/ItemEntityRendererMixin.java index ada3a88..54c389d 100644 --- a/src/main/java/interactic/mixin/ItemEntityRendererMixin.java +++ b/src/main/java/interactic/mixin/ItemEntityRendererMixin.java @@ -57,7 +57,7 @@ private void onConstructor(EntityRendererFactory.Context context, CallbackInfo c this.shadowRadius = 0; } - @Inject(at = @At("HEAD"), method = "render", cancellable = true) + @Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/entity/ItemEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", cancellable = true) private void render(ItemEntity entity, float f, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider, int light, CallbackInfo callback) { if (!InteracticInit.getConfig().fancyItemRendering) return; diff --git a/src/main/java/interactic/util/Helpers.java b/src/main/java/interactic/util/Helpers.java index d10c876..62b2e07 100644 --- a/src/main/java/interactic/util/Helpers.java +++ b/src/main/java/interactic/util/Helpers.java @@ -11,7 +11,6 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Vec3d; import java.util.Collection; @@ -43,7 +42,7 @@ public static boolean canPlayerPickUpItem(PlayerEntity player, ItemStack stack) if (!InteracticInit.getConfig().autoPickup) return false; if (!InteracticInit.getConfig().itemFilterEnabled) return true; - var filterOptional = ((PlayerInventoryAccessor) player.getInventory()).getCombinedInventory().stream().flatMap(Collection::stream).filter(itemStack -> itemStack.isOf(InteracticInit.ITEM_FILTER)).findFirst(); + var filterOptional = ((PlayerInventoryAccessor) player.getInventory()).getCombinedInventory().stream().flatMap(Collection::stream).filter(itemStack -> itemStack.isOf(InteracticInit.getItemFilter())).findFirst(); if (filterOptional.isEmpty()) return true; final ItemStack filterStack = filterOptional.get();