Active\Inactive tooltip moved to RC.

This commit is contained in:
drcrazy 2019-12-23 17:21:33 +03:00
parent 6dc1124bc6
commit e6707b2ddd
4 changed files with 9 additions and 22 deletions

View file

@ -164,11 +164,7 @@ public class IndustrialChainsawItem extends ChainsawItem {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { ItemUtils.buildActiveTooltip(stack, tooltip);
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + StringUtils.t("techreborn.message.nanosaberInactive")));
} else {
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + StringUtils.t("techreborn.message.nanosaberActive")));
}
} }
@Override @Override

View file

@ -216,11 +216,7 @@ public class IndustrialDrillItem extends DrillItem {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { ItemUtils.buildActiveTooltip(stack, tooltip);
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + StringUtils.t("techreborn.message.nanosaberInactive")));
} else {
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + StringUtils.t("techreborn.message.nanosaberActive")));
}
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -39,7 +39,7 @@ public class IndustrialJackhammerItem extends JackhammerItem {
// 4M FE max charge with 1k charge rate // 4M FE max charge with 1k charge rate
public IndustrialJackhammerItem() { public IndustrialJackhammerItem() {
super(ToolMaterials.IRON, TechRebornConfig.industrialJackhammerCharge); super(ToolMaterials.DIAMOND, TechRebornConfig.industrialJackhammerCharge);
this.cost = 250; this.cost = 250;
this.transferLimit = 1000; this.transferLimit = 1000;
} }

View file

@ -38,7 +38,6 @@ import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.items.ItemStackModifiers; import reborncore.api.items.ItemStackModifiers;
@ -123,7 +122,7 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive"))); + Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
} }
} else { } else {
stack.getTag().putBoolean("isActive", false); stack.getOrCreateTag().putBoolean("isActive", false);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " " Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
@ -144,7 +143,7 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " " Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating"))); + Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
} }
stack.getTag().putBoolean("isActive", false); stack.getOrCreateTag().putBoolean("isActive", false);
} }
} }
@ -177,16 +176,16 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
} }
ItemStack inactiveUncharged = new ItemStack(this); ItemStack inactiveUncharged = new ItemStack(this);
inactiveUncharged.setTag(new CompoundTag()); inactiveUncharged.setTag(new CompoundTag());
inactiveUncharged.getTag().putBoolean("isActive", false); inactiveUncharged.getOrCreateTag().putBoolean("isActive", false);
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER); ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
inactiveCharged.setTag(new CompoundTag()); inactiveCharged.setTag(new CompoundTag());
inactiveCharged.getTag().putBoolean("isActive", false); inactiveCharged.getOrCreateTag().putBoolean("isActive", false);
Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored()); Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored());
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER); ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
activeCharged.setTag(new CompoundTag()); activeCharged.setTag(new CompoundTag());
activeCharged.getTag().putBoolean("isActive", true); activeCharged.getOrCreateTag().putBoolean("isActive", true);
Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored()); Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored());
itemList.add(inactiveUncharged); itemList.add(inactiveUncharged);
@ -197,11 +196,7 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { ItemUtils.buildActiveTooltip(stack, tooltip);
tooltip.add(new TranslatableText("techreborn.message.nanosaberInactive").formatted(Formatting.GRAY));
} else {
tooltip.add(new TranslatableText("techreborn.message.nanosaberActive").formatted(Formatting.GRAY));
}
} }
// IEnergyItemInfo // IEnergyItemInfo