Skip to content

Commit

Permalink
Disable potion model + add setting for 1.15 arm swing fix!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Jun 26, 2024
1 parent 4f99145 commit 026adcf
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<EntityItem> 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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IBakedModel> 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<IBakedModel> cir) {
// if (stack == null) return;
// if (!OldAnimationsSettings.oldSkulls || !OldAnimationsSettings.INSTANCE.enabled) return;
// if (stack.getItem() instanceof ItemSkull) {
// cir.setReturnValue(SkullModelHook.INSTANCE.getSkullModel(stack));
// }
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
// }

}
Loading

0 comments on commit 026adcf

Please sign in to comment.