Updated addInformation method for blocks and items

This commit is contained in:
drcrazy 2019-02-21 01:53:33 +03:00
parent 6be1fbc4e9
commit 1567920c8e
8 changed files with 56 additions and 31 deletions

View file

@ -40,6 +40,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -183,8 +185,8 @@ public class BlockAlarm extends BaseTileBlock {
} }
@Override @Override
public void addInformation(final ItemStack stack, final World world, final List<String> tooltip, ITooltipFlag flag) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.tooltip.alarm")); tooltip.add(new TextComponentTranslation("techreborn.tooltip.alarm").applyTextStyle(TextFormatting.GRAY));
} }
} }

View file

@ -27,12 +27,17 @@ package techreborn.blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
public class BlockSupercondensator extends BlockMachineBase { public class BlockSupercondensator extends BlockMachineBase {
public BlockSupercondensator(Material material) { public BlockSupercondensator(Material material) {
super(); super();
@ -41,9 +46,9 @@ public class BlockSupercondensator extends BlockMachineBase {
} }
@Override @Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.RED + "WIP Coming Soon"); tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -36,6 +36,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -77,11 +80,12 @@ public class BlockFusionCoil extends Block {
} }
return false; return false;
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add("Right click Fusion Control computer to auto place"); //TODO: Translate
tooltip.add(new TextComponentString("Right click Fusion Control computer to auto place"));
} }
} }

View file

@ -26,7 +26,10 @@ package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
@ -35,6 +38,8 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn; import techreborn.TechReborn;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
public class BlockMagicEnergyAbsorber extends BlockMachineBase { public class BlockMagicEnergyAbsorber extends BlockMachineBase {
public BlockMagicEnergyAbsorber() { public BlockMagicEnergyAbsorber() {
@ -43,8 +48,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
} }
@Override @Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.RED + "WIP Coming Soon"); tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -26,7 +26,10 @@ package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
@ -35,6 +38,8 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn; import techreborn.TechReborn;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
public class BlockMagicEnergyConverter extends BlockMachineBase { public class BlockMagicEnergyConverter extends BlockMachineBase {
public BlockMagicEnergyConverter() { public BlockMagicEnergyConverter() {
@ -43,10 +48,10 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
} }
@Override @Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.RED + "WIP Coming Soon"); tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
//TODO // TODO
//Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }
@Override @Override

View file

@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -111,22 +112,20 @@ public class ItemFrequencyTransmitter extends Item {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public void addInformation(ItemStack stack, public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
@Nullable
World worldIn, List<String> 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")) { 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 x = stack.getTag().getInt("x");
int y = stack.getTag().getInt("y"); int y = stack.getTag().getInt("y");
int z = stack.getTag().getInt("z"); int z = stack.getTag().getInt("z");
int dim = stack.getTag().getInt("dim"); int dim = stack.getTag().getInt("dim");
tooltip.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x); tooltip.add(new TextComponentString(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x));
tooltip.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y); tooltip.add(new TextComponentString(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y));
tooltip.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z); tooltip.add(new TextComponentString(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z));
tooltip.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName()); tooltip.add(new TextComponentString(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
} else { } else {
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet")); tooltip.add(new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet")));
} }
} }

View file

@ -40,8 +40,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -228,13 +231,11 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@Override @Override
public void addInformation(ItemStack stack, public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
@Nullable
World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive")); tooltip.add(new TextComponentTranslation("techreborn.message.nanosaberInactive").applyTextStyle(TextFormatting.GRAY));
} else { } else {
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberActive")); tooltip.add(new TextComponentTranslation("techreborn.message.nanosaberActive").applyTextStyle(TextFormatting.GRAY));
} }
} }

View file

@ -35,6 +35,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; 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.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -133,8 +135,10 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
} }
@Override @Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) { public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.RED + "WIP Coming Soon"); tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
// TODO
// Remember to remove WIP override and imports once complete
} }
@Override @Override