Skip to content

Commit

Permalink
Ink Tanks now display locked color in their tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Cibernet83 committed Mar 3, 2024
1 parent 00cfe5f commit 508ddb3
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main/java/net/splatcraft/forge/items/InkTankItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -119,16 +120,25 @@ public void inventoryTick(@NotNull ItemStack stack, @NotNull Level level, @NotNu
}

@Override
public void appendHoverText(@NotNull ItemStack stack, @Nullable Level level, @NotNull List<Component> tooltip, @NotNull TooltipFlag flag) {
public void appendHoverText(@NotNull ItemStack stack, @Nullable Level level, @NotNull List<Component> tooltip, @NotNull TooltipFlag flag)
{
if (ColorUtils.isColorLocked(stack))
tooltip.add(ColorUtils.getFormatedColorName(ColorUtils.getInkColor(stack), true));

super.appendHoverText(stack, level, tooltip, flag);
if (!canRecharge(stack, false)) {
tooltip.add(new TranslatableComponent("item.splatcraft.ink_tank.cant_recharge"));
}

if (flag.isAdvanced() && !stack.getOrCreateTag().getBoolean("HideTooltip")) {
tooltip.add(new TranslatableComponent("item.splatcraft.ink_tank.ink", String.format("%.1f", getInkAmount(stack)), capacity));
if(!stack.getOrCreateTag().getBoolean("HideTooltip"))
{
if (!canRecharge(stack, false)) {
tooltip.add(new TranslatableComponent("item.splatcraft.ink_tank.cant_recharge"));
}

if (flag.isAdvanced()) {
tooltip.add(new TranslatableComponent("item.splatcraft.ink_tank.ink", String.format("%.1f", getInkAmount(stack)), capacity));
}
}


}

private static boolean initModels = false;
Expand Down

0 comments on commit 508ddb3

Please sign in to comment.