diff options
Diffstat (limited to 'src/main/java/dulkirmod/mixins')
-rw-r--r-- | src/main/java/dulkirmod/mixins/MixinItem.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinItem.java b/src/main/java/dulkirmod/mixins/MixinItem.java index d3cb421..62ae99d 100644 --- a/src/main/java/dulkirmod/mixins/MixinItem.java +++ b/src/main/java/dulkirmod/mixins/MixinItem.java @@ -1,6 +1,9 @@ package dulkirmod.mixins; import dulkirmod.DulkirMod; +import dulkirmod.config.DulkirConfig; +import dulkirmod.features.ImpactDisplay; +import dulkirmod.features.ReaperDisplay; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; @@ -16,4 +19,21 @@ public class MixinItem { if (DulkirMod.Companion.getConfig().getCancelReequip()) ci.setReturnValue(false); } + + @Inject(method = "showDurabilityBar(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), + cancellable = true, remap = false) + public void shouldShowDur(ItemStack stack, CallbackInfoReturnable<Boolean> cir) { + if (DulkirConfig.INSTANCE.getDisplayReaperCD()) + ReaperDisplay.INSTANCE.shouldDisplay(stack, cir); + if (DulkirConfig.INSTANCE.getDisplayImpactCD()) + ImpactDisplay.INSTANCE.shouldDisplay(stack, cir); + } + @Inject(method = "getDurabilityForDisplay(Lnet/minecraft/item/ItemStack;)D", at = @At("HEAD"), + cancellable = true, remap = false) + public void getItemHealthDisplayVal(ItemStack stack, CallbackInfoReturnable<Double> cir) { + if (DulkirConfig.INSTANCE.getDisplayReaperCD()) + ReaperDisplay.INSTANCE.calcDurability(stack, cir); + if (DulkirConfig.INSTANCE.getDisplayImpactCD()) + ImpactDisplay.INSTANCE.calcDurability(stack, cir); + } } |