fix minor rendering bug, add tooltips
This commit is contained in:
parent
92c8747dda
commit
9427f00c8f
4 changed files with 21 additions and 2 deletions
|
@ -1,10 +1,17 @@
|
|||
package buildcraft.core.utils;
|
||||
|
||||
public class ColorUtils {
|
||||
public static final int[] WOOL_TO_RGB = new int[]{
|
||||
public static final int[] WOOL_TO_RGB = new int[] {
|
||||
0xFFFFFF, 0xD87F33, 0xB24CD8, 0x6699D8,
|
||||
0xE5E533, 0x7FCC19, 0xF27FA5, 0x4C4C4C,
|
||||
0x999999, 0x4C7F99, 0x7F3FB2, 0x334CB2,
|
||||
0x664C33, 0x667F33, 0x993333, 0x191919
|
||||
};
|
||||
|
||||
public static final String[] WOOL_TO_NAME = new String[] {
|
||||
"white", "orange", "magenta", "light.blue",
|
||||
"yellow", "lime", "pink", "gray",
|
||||
"light.gray", "cyan", "purple", "blue",
|
||||
"brown", "green", "red", "black"
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,4 +29,8 @@ public final class StringUtils {
|
|||
public static boolean canLocalize(String key) {
|
||||
return StatCollector.canTranslate(key);
|
||||
}
|
||||
|
||||
public static String capitalize(String key) {
|
||||
return key.toUpperCase().substring(0, 1) + key.substring(1);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import java.util.List;
|
|||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.sun.xml.internal.ws.util.StringUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -19,6 +21,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -29,6 +32,7 @@ import buildcraft.api.core.IIconProvider;
|
|||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.IItemPipe;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.utils.ColorUtils;
|
||||
|
||||
public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
||||
|
||||
|
@ -148,6 +152,9 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
super.addInformation(stack, player, list, advanced);
|
||||
if (stack.getItemDamage() >= 1) {
|
||||
list.add(EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + StringUtils.capitalize(ColorUtils.WOOL_TO_NAME[(stack.getItemDamage() - 1) & 15].replace('.', ' ')));
|
||||
}
|
||||
Class<? extends Pipe> pipe = BlockGenericPipe.pipes.get(this);
|
||||
List<String> toolTip = PipeToolTipManager.getToolTip(pipe);
|
||||
list.addAll(toolTip);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
protected boolean attachPluggables = false;
|
||||
|
||||
private TileBuffer[] tileBuffer;
|
||||
|
||||
|
||||
public static class CoreState implements IClientState {
|
||||
public int pipeId = -1;
|
||||
public ItemGate.GatePluggable[] gates = new ItemGate.GatePluggable[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
|
@ -580,6 +580,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
bindPipe();
|
||||
|
||||
computeConnections();
|
||||
scheduleNeighborChange();
|
||||
scheduleRenderUpdate();
|
||||
|
||||
if (pipe.needsInit()) {
|
||||
|
|
Loading…
Reference in a new issue