From 026adcfc14f480428bd60fe091e66f51c68b7f60 Mon Sep 17 00:00:00 2001 From: Mixces Date: Wed, 26 Jun 2024 02:36:10 -0500 Subject: [PATCH] Disable potion model + add setting for 1.15 arm swing fix! --- .../config/OldAnimationsSettings.java | 59 ++--- .../mixin/EntityPlayerMixin.java | 4 +- .../mixin/ItemModelMesherMixin.java | 28 +-- .../mixin/RenderEntityItemMixin.java | 94 ++++---- .../mixin/RenderItemMixin.java | 206 +++++++++--------- .../overflowanimations/OverflowAnimations.kt | 8 +- 6 files changed, 203 insertions(+), 196 deletions(-) diff --git a/src/main/java/org/polyfrost/overflowanimations/config/OldAnimationsSettings.java b/src/main/java/org/polyfrost/overflowanimations/config/OldAnimationsSettings.java index 7732d87..8c790f8 100644 --- a/src/main/java/org/polyfrost/overflowanimations/config/OldAnimationsSettings.java +++ b/src/main/java/org/polyfrost/overflowanimations/config/OldAnimationsSettings.java @@ -238,35 +238,35 @@ public class OldAnimationsSettings extends Config { ) public static boolean enchantmentGlintGui = false; - @Switch( - name = "1.7 Potion Models (Held)", - description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion.", - subcategory = "Enchantment Glint" - ) - public static boolean oldPotions = true; - - @Switch( - name = "1.7 Potion Models (Dropped)", - description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion for dropped items as well.", - subcategory = "Enchantment Glint" - ) - public static boolean oldPotionsDropped = false; - - @Switch( - name = "1.7 Potion Models (GUI)", - description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion for gui items as well.", - subcategory = "Enchantment Glint" - ) - public static boolean oldPotionsGui = false; +// @Switch( +// name = "1.7 Potion Models (Held)", +// description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion.", +// subcategory = "Enchantment Glint" +// ) +// public static boolean oldPotions = true; +// +// @Switch( +// name = "1.7 Potion Models (Dropped)", +// description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion for dropped items as well.", +// subcategory = "Enchantment Glint" +// ) +// public static boolean oldPotionsDropped = false; +// +// @Switch( +// name = "1.7 Potion Models (GUI)", +// description = "Use the old potion models from 1.7, making the enchantment glint appear only on the colored part of the potion for gui items as well.", +// subcategory = "Enchantment Glint" +// ) +// public static boolean oldPotionsGui = false; // Item Changes - @Switch( - name = "1.7 Skulls", - description = "Displays skulls as a 2D sprite rather than a 3D model, like in 1.7.", - subcategory = "Item Changes" - ) - public static boolean oldSkulls = false; +// @Switch( +// name = "1.7 Skulls", +// description = "Displays skulls as a 2D sprite rather than a 3D model, like in 1.7.", +// subcategory = "Item Changes" +// ) +// public static boolean oldSkulls = false; @Switch( name = "1.7 Third-Person Fishing Rod Cast Texture", @@ -464,6 +464,13 @@ public class OldAnimationsSettings extends Config { ) public static boolean coloredBottles = false; + @Checkbox( + name = "Disable Drop Item Arm Swing in Chests", + description = "Disables the arm swinging animation upon dropping items while in Chests.", + category = "Misc", subcategory = "Fixes, QOL, and Tweaks" + ) + public static boolean modernDropSwingFix = true; + @Switch( name = "Disable Entity/Mob Third-Person Item Transformations", description = "Allows/Disallows mobs or entities to have third person item positions applied to them.", diff --git a/src/main/java/org/polyfrost/overflowanimations/mixin/EntityPlayerMixin.java b/src/main/java/org/polyfrost/overflowanimations/mixin/EntityPlayerMixin.java index 9cbe673..461ed4e 100644 --- a/src/main/java/org/polyfrost/overflowanimations/mixin/EntityPlayerMixin.java +++ b/src/main/java/org/polyfrost/overflowanimations/mixin/EntityPlayerMixin.java @@ -18,8 +18,8 @@ public class EntityPlayerMixin { @Inject(method = "dropItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;getEyeHeight()F")) public void overflowAnimations$dropItemSwing(ItemStack droppedItem, boolean dropAround, boolean traceItem, CallbackInfoReturnable cir) { - if (OldAnimationsSettings.modernDropSwing && OldAnimationsSettings.INSTANCE.enabled && - Minecraft.getMinecraft().theWorld.isRemote && Minecraft.getMinecraft().currentScreen instanceof GuiInventory) { + if (OldAnimationsSettings.modernDropSwing && OldAnimationsSettings.INSTANCE.enabled && Minecraft.getMinecraft().theWorld.isRemote) { + if (OldAnimationsSettings.modernDropSwingFix && Minecraft.getMinecraft().currentScreen instanceof GuiInventory) { return; } SwingHook.swingItem(); } } diff --git a/src/main/java/org/polyfrost/overflowanimations/mixin/ItemModelMesherMixin.java b/src/main/java/org/polyfrost/overflowanimations/mixin/ItemModelMesherMixin.java index 8cefabb..c8a3b85 100644 --- a/src/main/java/org/polyfrost/overflowanimations/mixin/ItemModelMesherMixin.java +++ b/src/main/java/org/polyfrost/overflowanimations/mixin/ItemModelMesherMixin.java @@ -14,19 +14,19 @@ @Mixin(ItemModelMesher.class) public class ItemModelMesherMixin { - @Inject( - method = "getItemModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/resources/model/IBakedModel;", - at = @At( - value = "HEAD" - ), - cancellable = true - ) - private void overflowanimations$useCustomBlockModel(ItemStack stack, CallbackInfoReturnable cir) { - if (stack == null) return; - if (!OldAnimationsSettings.oldSkulls || !OldAnimationsSettings.INSTANCE.enabled) return; - if (stack.getItem() instanceof ItemSkull) { - cir.setReturnValue(SkullModelHook.INSTANCE.getSkullModel(stack)); - } - } +// @Inject( +// method = "getItemModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/resources/model/IBakedModel;", +// at = @At( +// value = "HEAD" +// ), +// cancellable = true +// ) +// private void overflowanimations$useCustomBlockModel(ItemStack stack, CallbackInfoReturnable cir) { +// if (stack == null) return; +// if (!OldAnimationsSettings.oldSkulls || !OldAnimationsSettings.INSTANCE.enabled) return; +// if (stack.getItem() instanceof ItemSkull) { +// cir.setReturnValue(SkullModelHook.INSTANCE.getSkullModel(stack)); +// } +// } } \ No newline at end of file diff --git a/src/main/java/org/polyfrost/overflowanimations/mixin/RenderEntityItemMixin.java b/src/main/java/org/polyfrost/overflowanimations/mixin/RenderEntityItemMixin.java index a702485..1327db7 100644 --- a/src/main/java/org/polyfrost/overflowanimations/mixin/RenderEntityItemMixin.java +++ b/src/main/java/org/polyfrost/overflowanimations/mixin/RenderEntityItemMixin.java @@ -60,52 +60,52 @@ protected RenderEntityItemMixin(RenderManager renderManager) { } } - @ModifyVariable( - method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", - at = @At( - value = "STORE" - ), - index = 10 - ) - private ItemStack overflowAnimations$captureStack(ItemStack stack) { - overflowanimations$stack = stack; - return stack; - } - - @ModifyArg( - method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" - ), - index = 1 - ) - private IBakedModel overflowAnimations$swapToCustomModel(IBakedModel model) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsDropped) return model; - if (overflowanimations$stack.getItem() instanceof ItemPotion) { - return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); - } - return model; - } - - @Inject( - method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", - shift = At.Shift.AFTER - ) - ) - private void overflowAnimations$renderCustomBottle(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsDropped) return; - if (entity.getEntityItem().getItem() instanceof ItemPotion) { - itemRenderer.renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(entity.getEntityItem())); - } - } - - @Unique - private IBakedModel overflowAnimations$getBottleModel(ItemStack stack) { - return ItemPotion.isSplash(stack.getMetadata()) ? CustomModelBakery.BOTTLE_SPLASH_EMPTY.getBakedModel() : CustomModelBakery.BOTTLE_DRINKABLE_EMPTY.getBakedModel(); - } +// @ModifyVariable( +// method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", +// at = @At( +// value = "STORE" +// ), +// index = 10 +// ) +// private ItemStack overflowAnimations$captureStack(ItemStack stack) { +// overflowanimations$stack = stack; +// return stack; +// } +// +// @ModifyArg( +// method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" +// ), +// index = 1 +// ) +// private IBakedModel overflowAnimations$swapToCustomModel(IBakedModel model) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsDropped) return model; +// if (overflowanimations$stack.getItem() instanceof ItemPotion) { +// return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); +// } +// return model; +// } +// +// @Inject( +// method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", +// shift = At.Shift.AFTER +// ) +// ) +// private void overflowAnimations$renderCustomBottle(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsDropped) return; +// if (entity.getEntityItem().getItem() instanceof ItemPotion) { +// itemRenderer.renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(entity.getEntityItem())); +// } +// } +// +// @Unique +// private IBakedModel overflowAnimations$getBottleModel(ItemStack stack) { +// return ItemPotion.isSplash(stack.getMetadata()) ? CustomModelBakery.BOTTLE_SPLASH_EMPTY.getBakedModel() : CustomModelBakery.BOTTLE_DRINKABLE_EMPTY.getBakedModel(); +// } } diff --git a/src/main/java/org/polyfrost/overflowanimations/mixin/RenderItemMixin.java b/src/main/java/org/polyfrost/overflowanimations/mixin/RenderItemMixin.java index 04ebb76..7b83e13 100644 --- a/src/main/java/org/polyfrost/overflowanimations/mixin/RenderItemMixin.java +++ b/src/main/java/org/polyfrost/overflowanimations/mixin/RenderItemMixin.java @@ -41,8 +41,8 @@ public abstract class RenderItemMixin { public abstract void renderItem(ItemStack stack, IBakedModel model); @Shadow @Final private static ResourceLocation RES_ITEM_GLINT; - @Unique private ItemStack overflowanimations$stackGui = null; - @Unique private ItemStack overflowanimations$stackHeld = null; +// @Unique private ItemStack overflowanimations$stackGui = null; +// @Unique private ItemStack overflowanimations$stackHeld = null; @Unique private ItemStack overflowanimations$stack = null; @Unique public IBakedModel overflowAnimations$model; @@ -84,10 +84,10 @@ public abstract class RenderItemMixin { if (OldAnimationsSettings.itemSprites && OldAnimationsSettings.spritesGlint && TransformTypeHook.shouldNotHaveGlint()) { ci.cancel(); } - if (OldAnimationsSettings.enchantmentGlintGui && TransformTypeHook.isRenderingInGUI()) { - if (OldAnimationsSettings.oldPotionsGui && overflowanimations$stackGui.getItem() instanceof ItemPotion) { return; } - ci.cancel(); - } +// if (OldAnimationsSettings.enchantmentGlintGui && TransformTypeHook.isRenderingInGUI()) { +// if (OldAnimationsSettings.oldPotionsGui && overflowanimations$stackGui.getItem() instanceof ItemPotion) { return; } +// ci.cancel(); +// } } } @@ -173,7 +173,7 @@ public abstract class RenderItemMixin { ) public void overflowAnimations$renderGuiGlint(ItemStack stack, int x, int y, CallbackInfo ci) { if (OldAnimationsSettings.potionGlint && stack.getItem() instanceof ItemPotion) return; - if (OldAnimationsSettings.oldPotionsGui && stack.getItem() instanceof ItemPotion) return; +// if (OldAnimationsSettings.oldPotionsGui && stack.getItem() instanceof ItemPotion) return; if (OldAnimationsSettings.enchantmentGlintGui && OldAnimationsSettings.INSTANCE.enabled && stack.hasEffect()) { GlintModelHook.INSTANCE.renderGlintGui(x, y, RES_ITEM_GLINT); } @@ -244,101 +244,101 @@ public abstract class RenderItemMixin { return stack; } - @ModifyVariable( - method = "renderItemModelTransform", - at = @At( - value = "HEAD", - ordinal = 0 - ), - index = 1, - argsOnly = true - ) - private ItemStack overflowAnimations$captureHeldStack(ItemStack stack) { - overflowanimations$stackHeld = stack; - return stack; - } - - @ModifyArg( - method = "renderItemModelTransform", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" - ), - index = 1 - ) - private IBakedModel overflowAnimations$swapToCustomModel(IBakedModel model) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotions) return model; - if (overflowanimations$stackHeld.getItem() instanceof ItemPotion) { - return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); - } - return model; - } - - @Inject( - method = "renderItemModelTransform", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", - shift = At.Shift.AFTER - ) - ) - private void overflowAnimations$renderCustomBottle(ItemStack stack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, CallbackInfo ci) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotions) return; - - if (stack.getItem() instanceof ItemPotion) { - renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(stack)); - } - } - - @ModifyVariable( - method = "renderItemIntoGUI", - at = @At( - value = "HEAD", - ordinal = 0 - ), - index = 1, - argsOnly = true - ) - private ItemStack overflowAnimations$captureGuiStack(ItemStack stack) { - overflowanimations$stackGui = stack; - return stack; - } - - @ModifyArg( - method = "renderItemIntoGUI", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" - ), - index = 1 - ) - private IBakedModel overflowAnimations$swapToCustomModel2(IBakedModel model) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsGui) return model; - if (overflowanimations$stackGui.getItem() instanceof ItemPotion) { - return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); - } - return model; - } - - @Inject( - method = "renderItemIntoGUI", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", - shift = At.Shift.AFTER - ) - ) - private void overflowAnimations$renderCustomBottle2(ItemStack stack, int x, int y, CallbackInfo ci) { - if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsGui) return; - - if (stack.getItem() instanceof ItemPotion) { - renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(stack)); - } - } - - @Unique - private IBakedModel overflowAnimations$getBottleModel(ItemStack stack) { - return ItemPotion.isSplash(stack.getMetadata()) ? CustomModelBakery.BOTTLE_SPLASH_EMPTY.getBakedModel() : CustomModelBakery.BOTTLE_DRINKABLE_EMPTY.getBakedModel(); - } +// @ModifyVariable( +// method = "renderItemModelTransform", +// at = @At( +// value = "HEAD", +// ordinal = 0 +// ), +// index = 1, +// argsOnly = true +// ) +// private ItemStack overflowAnimations$captureHeldStack(ItemStack stack) { +// overflowanimations$stackHeld = stack; +// return stack; +// } +// +// @ModifyArg( +// method = "renderItemModelTransform", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" +// ), +// index = 1 +// ) +// private IBakedModel overflowAnimations$swapToCustomModel(IBakedModel model) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotions) return model; +// if (overflowanimations$stackHeld.getItem() instanceof ItemPotion) { +// return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); +// } +// return model; +// } +// +// @Inject( +// method = "renderItemModelTransform", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", +// shift = At.Shift.AFTER +// ) +// ) +// private void overflowAnimations$renderCustomBottle(ItemStack stack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, CallbackInfo ci) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotions) return; +// +// if (stack.getItem() instanceof ItemPotion) { +// renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(stack)); +// } +// } +// +// @ModifyVariable( +// method = "renderItemIntoGUI", +// at = @At( +// value = "HEAD", +// ordinal = 0 +// ), +// index = 1, +// argsOnly = true +// ) +// private ItemStack overflowAnimations$captureGuiStack(ItemStack stack) { +// overflowanimations$stackGui = stack; +// return stack; +// } +// +// @ModifyArg( +// method = "renderItemIntoGUI", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V" +// ), +// index = 1 +// ) +// private IBakedModel overflowAnimations$swapToCustomModel2(IBakedModel model) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsGui) return model; +// if (overflowanimations$stackGui.getItem() instanceof ItemPotion) { +// return CustomModelBakery.BOTTLE_OVERLAY.getBakedModel(); +// } +// return model; +// } +// +// @Inject( +// method = "renderItemIntoGUI", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", +// shift = At.Shift.AFTER +// ) +// ) +// private void overflowAnimations$renderCustomBottle2(ItemStack stack, int x, int y, CallbackInfo ci) { +// if (!OldAnimationsSettings.INSTANCE.enabled || !OldAnimationsSettings.oldPotionsGui) return; +// +// if (stack.getItem() instanceof ItemPotion) { +// renderItem(new ItemStack(Items.glass_bottle), overflowAnimations$getBottleModel(stack)); +// } +// } +// +// @Unique +// private IBakedModel overflowAnimations$getBottleModel(ItemStack stack) { +// return ItemPotion.isSplash(stack.getMetadata()) ? CustomModelBakery.BOTTLE_SPLASH_EMPTY.getBakedModel() : CustomModelBakery.BOTTLE_DRINKABLE_EMPTY.getBakedModel(); +// } } diff --git a/src/main/kotlin/org/polyfrost/overflowanimations/OverflowAnimations.kt b/src/main/kotlin/org/polyfrost/overflowanimations/OverflowAnimations.kt index b2e6f2a..54cc11c 100644 --- a/src/main/kotlin/org/polyfrost/overflowanimations/OverflowAnimations.kt +++ b/src/main/kotlin/org/polyfrost/overflowanimations/OverflowAnimations.kt @@ -44,10 +44,10 @@ object OverflowAnimations { @JvmField var isDamageTintPresent: Boolean = false - @Mod.EventHandler - fun preInit(event: FMLPreInitializationEvent) { - CustomModelBakery - } +// @Mod.EventHandler +// fun preInit(event: FMLPreInitializationEvent) { +// CustomModelBakery +// } @Mod.EventHandler fun init(event: FMLInitializationEvent) {