blob: 13e1456fb8844c715d650f463842a20ac4ce7a01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package com.dulkirfabric.mixin;
import com.dulkirfabric.config.DulkirConfig;
import com.dulkirfabric.features.CooldownDisplays;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Item.class)
public class ItemMixin {
@Inject(method = "isItemBarVisible(Lnet/minecraft/item/ItemStack;)Z",
at = @At("HEAD"), cancellable = true)
public void shouldDisplayDurabilityBar(ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
if (DulkirConfig.ConfigVars.getConfigOptions().getDuraCooldown())
CooldownDisplays.INSTANCE.shouldDisplay(stack, cir);
}
@Inject(method = "getItemBarStep(Lnet/minecraft/item/ItemStack;)I",
at = @At("HEAD"), cancellable = true)
public void calculateItemHealth(ItemStack stack, CallbackInfoReturnable<Integer> cir) {
if (DulkirConfig.ConfigVars.getConfigOptions().getDuraCooldown())
CooldownDisplays.INSTANCE.calcDurability(stack, cir);
}
}
|