Fixed textformatting warnings

This commit is contained in:
drcrazy 2017-10-07 14:39:30 +03:00
parent a80409c138
commit 12e2cbe11b
2 changed files with 17 additions and 12 deletions

View file

@ -34,13 +34,13 @@ import net.minecraft.util.math.BlockPos;
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.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.hud.StackInfoElement; import reborncore.client.hud.StackInfoElement;
import reborncore.common.util.ChatUtils; import reborncore.common.util.ChatUtils;
import reborncore.common.util.Color;
import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModItems; import techreborn.init.ModItems;
import techreborn.lib.MessageIDs; import techreborn.lib.MessageIDs;
@ -110,20 +110,22 @@ public class ItemFrequencyTransmitter extends ItemTR {
return new ActionResult<>(EnumActionResult.SUCCESS, stack); return new ActionResult<>(EnumActionResult.SUCCESS, stack);
} }
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { @SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) { if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) {
int x = stack.getTagCompound().getInteger("x"); int x = stack.getTagCompound().getInteger("x");
int y = stack.getTagCompound().getInteger("y"); int y = stack.getTagCompound().getInteger("y");
int z = stack.getTagCompound().getInteger("z"); int z = stack.getTagCompound().getInteger("z");
int dim = stack.getTagCompound().getInteger("dim"); int dim = stack.getTagCompound().getInteger("dim");
list.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x); tooltip.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x);
list.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y); tooltip.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y);
list.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z); tooltip.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z);
list.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName()); tooltip.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
} else { } else {
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet")); tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet"));
} }
} }
@ -135,8 +137,8 @@ public class ItemFrequencyTransmitter extends ItemTR {
@Override @Override
public String getText(ItemStack stack) { public String getText(ItemStack stack) {
String text = ""; String text = "";
Color gold = Color.GOLD; TextFormatting gold = TextFormatting.GOLD;
Color grey = Color.GRAY; TextFormatting grey = TextFormatting.GRAY;
if (stack.getItem() instanceof ItemFrequencyTransmitter) { if (stack.getItem() instanceof ItemFrequencyTransmitter) {
if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) { if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) {
int coordX = stack.getTagCompound().getInteger("x"); int coordX = stack.getTagCompound().getInteger("x");

View file

@ -41,6 +41,7 @@ import net.minecraft.util.*;
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.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -139,11 +140,13 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
itemList.add(activeCharged); itemList.add(activeCharged);
} }
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { @SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) { if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive")); tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive"));
} else { } else {
list.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberActive")); tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberActive"));
} }
} }