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.math.AxisAlignedBB;
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.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
@ -183,8 +185,8 @@ public class BlockAlarm extends BaseTileBlock {
}
@Override
public void addInformation(final ItemStack stack, final World world, final List<String> tooltip, ITooltipFlag flag) {
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.tooltip.alarm"));
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
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.client.util.ITooltipFlag;
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.world.IBlockReader;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import java.util.List;
import javax.annotation.Nullable;
public class BlockSupercondensator extends BlockMachineBase {
public BlockSupercondensator(Material material) {
super();
@ -41,8 +46,8 @@ public class BlockSupercondensator extends BlockMachineBase {
}
@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 IBlockReader 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
}

View file

@ -36,6 +36,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
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.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -80,8 +83,9 @@ public class BlockFusionCoil extends Block {
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add("Right click Fusion Control computer to auto place");
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
//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.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -35,6 +38,8 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import java.util.List;
import javax.annotation.Nullable;
public class BlockMagicEnergyAbsorber extends BlockMachineBase {
public BlockMagicEnergyAbsorber() {
@ -43,8 +48,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
}
@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 IBlockReader 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
}

View file

@ -26,7 +26,10 @@ package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag;
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.world.IBlockReader;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -35,6 +38,8 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import java.util.List;
import javax.annotation.Nullable;
public class BlockMagicEnergyConverter extends BlockMachineBase {
public BlockMagicEnergyConverter() {
@ -43,8 +48,8 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
}
@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 IBlockReader 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
}

View file

@ -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")));
}
}

View file

@ -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));
}
}

View file

@ -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