diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-27 04:38:13 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-27 04:38:13 -0230 |
commit | 7809a1362c9644c9bfb69d8563a13e3f1ed3354a (patch) | |
tree | d8e1a33db7656aa2aeaa9fcc44e2310df35b774d /src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java | |
parent | 39749967fc92a3976b231285492d71f8782e93da (diff) | |
download | SkyblockHud-Death-Defied-7809a1362c9644c9bfb69d8563a13e3f1ed3354a.tar.gz SkyblockHud-Death-Defied-7809a1362c9644c9bfb69d8563a13e3f1ed3354a.tar.bz2 SkyblockHud-Death-Defied-7809a1362c9644c9bfb69d8563a13e3f1ed3354a.zip |
Added Dynamic Item Cooldowns.
Updated Profile Events to contain profile name.
Added copy NPC skin command.
Added warphandler gives me access to what warps you have.
Moved all config and data files into its own folder.
Added option to turn off adding back overflow mana.
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java new file mode 100644 index 0000000..1f372ad --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java @@ -0,0 +1,42 @@ +package com.thatgravyboat.skyblockhud.mixins; + +import com.thatgravyboat.skyblockhud.SkyblockHud; +import com.thatgravyboat.skyblockhud.api.item.IAbility; +import com.thatgravyboat.skyblockhud.handlers.CooldownHandler; +import java.util.regex.Matcher; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +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.CallbackInfo; + +@Mixin(ItemStack.class) +public class MixinItemStack implements IAbility { + + private String ability; + private int abilityTime; + + @Inject(method = "setTagCompound", at = @At("HEAD")) + public void onNbt(NBTTagCompound nbt, CallbackInfo ci) { + if (SkyblockHud.config != null && !SkyblockHud.config.misc.hideItemCooldowns) { + Matcher abilityMatcher = CooldownHandler.getAbility(nbt); + if (abilityMatcher != null) { + ability = abilityMatcher.group(1); + try { + abilityTime = Integer.parseInt(abilityMatcher.group(2).trim()); + } catch (Exception ignored) {} + } + } + } + + @Override + public String getAbility() { + return ability; + } + + @Override + public int getAbilityTime() { + return abilityTime; + } +} |