Skip to content

Commit

Permalink
stop overflowanimations config from corrupting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jun 24, 2024
1 parent 069043a commit 1f95520
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class OldAnimationsSettings extends Config {
category = "Animations",
subcategory = "Interaction"
)
public int redArmor = 3;
public int armorDamageTintStyle = 3;

@Switch(
name = "1.7 Item Switching Animation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public abstract class LayerArmorBaseMixin<T extends ModelBase> implements LayerR

@Inject(method = "renderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$addRender(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float partialTicks, float p_177182_5_, float p_177182_6_, float p_177182_7_, float scale, int armorSlot, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 3 && OldAnimationsSettings.INSTANCE.enabled && ((RendererLivingEntityInvoker) renderer).invokeSetDoRenderBrightness(entitylivingbaseIn, partialTicks)) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 3 && OldAnimationsSettings.INSTANCE.enabled && ((RendererLivingEntityInvoker) renderer).invokeSetDoRenderBrightness(entitylivingbaseIn, partialTicks)) {
overflowAnimations$t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, scale);
((RendererLivingEntityInvoker) renderer).invokeUnsetBrightness();
}
}

@Inject(method = "shouldCombineTextures", at = @At(value = "HEAD"), cancellable = true)
public void overflowAnimations$allowCombine(CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(OldAnimationsSettings.INSTANCE.redArmor == 2 && OldAnimationsSettings.INSTANCE.enabled);
cir.setReturnValue(OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 2 && OldAnimationsSettings.INSTANCE.enabled);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerArmorBaseMixin<T extends ModelBase> implements LayerR

@Inject(method = "renderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", ordinal = 1, shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float partialTicks, float p_177182_5_, float p_177182_6_, float p_177182_7_, float scale, int armorSlot, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
T t = this.getArmorModel(armorSlot);
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerEnderDragonEyesMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/boss/EntityDragon;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntityDragon entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerEndermanEyesMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/monster/EntityEnderman;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntityEnderman entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerSaddleMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/passive/EntityPig;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPig;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntityPig var1, float var2, float var3, float var4, float var5, float var6, float var7, float var8, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = var1.hurtTime > 0 || var1.deathTime > 0;
HitColorHook.renderHitColorPre(var1, bl, var4);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerSheepWoolMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/passive/EntitySheep;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelSheep1;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntitySheep entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerSlimeGelMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/monster/EntitySlime;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER), cancellable = true)
public void overflowAnimations$renderHitColor(EntitySlime var1, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = var1.hurtTime > 0 || var1.deathTime > 0;
HitColorHook.renderHitColorPre(var1, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerSpiderEyesMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/monster/EntitySpider;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntitySpider entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class LayerWolfCollarMixin {

@Inject(method = "doRenderLayer(Lnet/minecraft/entity/passive/EntityWolf;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", shift = At.Shift.AFTER))
public void overflowAnimations$renderHitColor(EntityWolf entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
boolean bl = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0;
HitColorHook.renderHitColorPre(entitylivingbaseIn, bl, partialTicks);
if (bl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ protected RendererLivingEntityMixin(RenderManager renderManager) {

@Redirect(method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RendererLivingEntity;setDoRenderBrightness(Lnet/minecraft/entity/EntityLivingBase;F)Z"))
public boolean overflowAnimations$disableBrightness(RendererLivingEntity<?> instance, T entityLivingBaseIn, float partialTicks) {
return (OldAnimationsSettings.INSTANCE.redArmor != 1 || !OldAnimationsSettings.INSTANCE.enabled) && setDoRenderBrightness(entityLivingBaseIn, partialTicks);
return (OldAnimationsSettings.INSTANCE.armorDamageTintStyle != 1 || !OldAnimationsSettings.INSTANCE.enabled) && setDoRenderBrightness(entityLivingBaseIn, partialTicks);
}

@Redirect(method = "renderLayers", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RendererLivingEntity;setBrightness(Lnet/minecraft/entity/EntityLivingBase;FZ)Z"))
public boolean overflowAnimations$disableLayerBrightness(RendererLivingEntity<?> instance, T f2, float f3, boolean f4) {
return (OldAnimationsSettings.INSTANCE.redArmor != 1 || !OldAnimationsSettings.INSTANCE.enabled) && setBrightness(f2, f3, f4);
return (OldAnimationsSettings.INSTANCE.armorDamageTintStyle != 1 || !OldAnimationsSettings.INSTANCE.enabled) && setBrightness(f2, f3, f4);
}

@Inject(method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;depthMask(Z)V"))
public void overflowAnimations$renderHitColor(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
if (OldAnimationsSettings.INSTANCE.redArmor == 1 && OldAnimationsSettings.INSTANCE.enabled) {
if (OldAnimationsSettings.INSTANCE.armorDamageTintStyle == 1 && OldAnimationsSettings.INSTANCE.enabled) {
float f = interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks);
float f1 = interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks);
float f2 = f1 - f;
Expand Down

0 comments on commit 1f95520

Please sign in to comment.