Updated addInformation method for blocks and items
This commit is contained in:
parent
6be1fbc4e9
commit
1567920c8e
8 changed files with 56 additions and 31 deletions
|
@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -111,22 +112,20 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (stack.hasTag() && stack.getTag() != null && stack.getTag().hasKey("x") && stack.getTag().hasKey("y") && stack.getTag().hasKey("z") && stack.getTag().hasKey("dim")) {
|
||||
int x = stack.getTag().getInt("x");
|
||||
int y = stack.getTag().getInt("y");
|
||||
int z = stack.getTag().getInt("z");
|
||||
int dim = stack.getTag().getInt("dim");
|
||||
|
||||
tooltip.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x);
|
||||
tooltip.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y);
|
||||
tooltip.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z);
|
||||
tooltip.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x));
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y));
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z));
|
||||
tooltip.add(new TextComponentString(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
|
||||
|
||||
} else {
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet"));
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -228,13 +231,11 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive"));
|
||||
tooltip.add(new TextComponentTranslation("techreborn.message.nanosaberInactive").applyTextStyle(TextFormatting.GRAY));
|
||||
} else {
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberActive"));
|
||||
tooltip.add(new TextComponentTranslation("techreborn.message.nanosaberActive").applyTextStyle(TextFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -133,8 +135,10 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
|
||||
// TODO
|
||||
// Remember to remove WIP override and imports once complete
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue