Finally fixed names
took me all week too get the name to work for the lang file but now there done. Still not sure why they didn't work, most likely i should find out but meh. Also: *Added a way to ID Milk if someone adds it to minecraft as a liquid block, might make it into a block later if not don by LiQuid. *Change: ColorCode and LiquidHandler method to work a little better so i don't have to manual change each liquid that is added to the LiquidData
This commit is contained in:
parent
8b1179699f
commit
6db9138c5a
5 changed files with 113 additions and 110 deletions
|
@ -44,10 +44,7 @@ public enum ColorCode
|
|||
return ColorCode.values()[((Integer) obj)];
|
||||
} else if (obj instanceof LiquidData)
|
||||
{
|
||||
LiquidData data = (LiquidData) obj;
|
||||
if (data == LiquidHandler.lava) { return RED; }
|
||||
if (data == LiquidHandler.steam) { return ORANGE; }
|
||||
if (data == LiquidHandler.water) { return BLUE; }
|
||||
return ((LiquidData) obj).getColor();
|
||||
} else if (obj instanceof ColorCode)
|
||||
{
|
||||
return (ColorCode) obj;
|
||||
|
|
|
@ -22,6 +22,7 @@ public class LiquidHandler
|
|||
public static LiquidData lava;
|
||||
public static LiquidData unkown;
|
||||
public static LiquidData waste;
|
||||
public static LiquidData milk;
|
||||
|
||||
// public static LiquidData oil; TODO add
|
||||
// public static LiquidData fuel;
|
||||
|
@ -30,12 +31,13 @@ public class LiquidHandler
|
|||
*/
|
||||
public static void addDefaultLiquids()
|
||||
{
|
||||
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), ColorCode.BLUE, false, 32);
|
||||
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), ColorCode.BLUE, false, 60);
|
||||
allowedLiquids.add(water);
|
||||
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), ColorCode.RED, false, 20);
|
||||
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), ColorCode.RED, false, 40);
|
||||
allowedLiquids.add(lava);
|
||||
unkown = new LiquidData("Unknown", LiquidDictionary.getOrCreateLiquid("Unknown", new LiquidStack(20, 1)), ColorCode.NONE, false, 32);
|
||||
allowedLiquids.add(unkown);
|
||||
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
@ -62,6 +64,10 @@ public class LiquidHandler
|
|||
{
|
||||
this.waste = new LiquidData("Waste", event.Liquid, ColorCode.BROWN, false, 40);
|
||||
this.allowedLiquids.add(waste);
|
||||
}else if(event.Name.equalsIgnoreCase("Milk"))
|
||||
{
|
||||
this.milk = new LiquidData("Milk", event.Liquid, ColorCode.WHITE, false, 50);
|
||||
this.allowedLiquids.add(milk);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,27 +133,18 @@ public class LiquidHandler
|
|||
if(stack == null){return null;}
|
||||
return new LiquidStack(stack.itemID,vol,stack.itemMeta);
|
||||
}
|
||||
public static int getMeta(LiquidData type)
|
||||
public static int getMeta(LiquidData stack)
|
||||
{
|
||||
if (type == LiquidHandler.steam) return 0;
|
||||
if (type == LiquidHandler.water) return 1;
|
||||
if (type == LiquidHandler.lava) return 2;
|
||||
return 20;
|
||||
if(stack != null && stack != unkown)
|
||||
{
|
||||
return stack.getColor().ordinal();
|
||||
}
|
||||
return 15;
|
||||
}
|
||||
|
||||
public static LiquidData getFromMeta(int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return steam;
|
||||
case 1:
|
||||
return water;
|
||||
case 2:
|
||||
return lava;
|
||||
}
|
||||
return unkown;
|
||||
|
||||
{
|
||||
return ColorCode.get(meta).getLiquidData();
|
||||
}
|
||||
|
||||
public static LiquidData getFromBlockID(int id)
|
||||
|
|
|
@ -16,68 +16,73 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
public class ItemGuage extends Item
|
||||
{
|
||||
private int spawnID;
|
||||
private int spawnID;
|
||||
|
||||
public ItemGuage(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("lmTool");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
|
||||
}
|
||||
public ItemGuage(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("lmTool");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
switch (par1)
|
||||
{
|
||||
case 0:
|
||||
return 24;
|
||||
}
|
||||
return this.iconIndex;
|
||||
}
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return "lmTools";
|
||||
}
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
switch (par1)
|
||||
{
|
||||
case 0:
|
||||
return 24;
|
||||
case 1:
|
||||
}
|
||||
return this.iconIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int x, int y, int z, int side, float par8, float par9, float par10)
|
||||
{
|
||||
if (!par3World.isRemote)
|
||||
{
|
||||
if (itemStack.getItemDamage() == 0)
|
||||
{
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(x, y, z);
|
||||
if (blockEntity instanceof IReadOut)
|
||||
{
|
||||
String output = ((IReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side));
|
||||
if (output.length() > 100)
|
||||
output = output.substring(0, 100);
|
||||
output.trim();
|
||||
player.sendChatToPlayer("ReadOut: " + output);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int x, int y, int z, int side, float par8, float par9, float par10)
|
||||
{
|
||||
if (!par3World.isRemote)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(x, y, z);
|
||||
|
||||
}
|
||||
// pipe Guage
|
||||
if (meta == 0)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
if (blockEntity instanceof IReadOut)
|
||||
{
|
||||
String output = ((IReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side));
|
||||
if (output.length() > 100)
|
||||
{
|
||||
output = output.substring(0, 100);
|
||||
}
|
||||
output.trim();
|
||||
player.sendChatToPlayer("ReadOut: " + output);
|
||||
}
|
||||
} else if (meta == 1)
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return this.getItemName() + "." + itemstack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,25 +9,22 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* A metadata item containing parts of various machines in Liquid Mechanics Mod.
|
||||
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
|
||||
*
|
||||
* @author Rs
|
||||
*
|
||||
*/
|
||||
* @author Rs */
|
||||
public class ItemParts extends Item
|
||||
{
|
||||
public enum Parts
|
||||
{
|
||||
Bronze("Bronze Tube", 0),
|
||||
Iron("Iron Tube", 1),
|
||||
Obby("Obby Tube", 2),
|
||||
Nether("Nether Tube", 3),
|
||||
Seal("Leather Seal", 16),
|
||||
SlimeSeal("Slime Seal", 17),
|
||||
Tank("Unfinished Tank", 18),
|
||||
Bronze("Bronze", 0),
|
||||
Iron("Iron", 1),
|
||||
Obby("Obby", 2),
|
||||
Nether("Nether", 3),
|
||||
Seal("Seal", 16),
|
||||
SlimeSeal("Slime", 17),
|
||||
Tank("Tank", 18),
|
||||
Valve("Valve", 19);
|
||||
|
||||
|
||||
public String name;
|
||||
public int itemIndex;
|
||||
|
||||
|
@ -41,12 +38,11 @@ public class ItemParts extends Item
|
|||
public ItemParts(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setItemName("lmParts");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setMaxStackSize(64);
|
||||
this.setItemName("lmPart");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,9 +53,22 @@ public class ItemParts extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
public String getTextureFile()
|
||||
{
|
||||
return this.getItemName()+"." + itemstack.getItemDamage();
|
||||
return LiquidMechanics.ITEM_TEXTURE_FILE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack i)
|
||||
{
|
||||
int j = i.getItemDamage();
|
||||
return i.getItem().getItemName() + "." + j;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,10 +79,4 @@ public class ItemParts extends Item
|
|||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return "lmParts";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,15 +41,16 @@ tile.lmTank.12.name =LightBlue Tank
|
|||
tile.lmTank.13.name =Magenta Tank
|
||||
tile.lmTank.14.name =Steam Tank
|
||||
tile.lmTank.15.name =Generic Tank
|
||||
|
||||
# Items
|
||||
item.lmTools.0.name=Pipe Guage
|
||||
item.lmPart.0.name=Bronze Tube
|
||||
item.lmPart.1.name=Iron Tube
|
||||
item.lmPart.2.name=Obby Tube
|
||||
item.lmPart.3.name=Nether Tube
|
||||
item.lmPart.4.name=Leather Seal
|
||||
item.lmPart.5.name=Slime Seal
|
||||
item.lmPart.6.name=Unfinished Tank
|
||||
item.lmPart.7.name=Valve
|
||||
|
||||
item.lmParts.0.name=Bronze Tube
|
||||
item.lmParts.1.name=Iron Tube
|
||||
item.lmParts.2.name=Obby Tube
|
||||
item.lmParts.3.name=Nether Tube
|
||||
item.lmParts.4.name=Leather Seal
|
||||
item.lmParts.5.name=Slime Seal
|
||||
item.lmParts.6.name=Unfinished Tank
|
||||
item.lmParts.7.name=Valve
|
||||
item.lmTool.0.name=Pipe Guage
|
||||
|
||||
|
|
Loading…
Reference in a new issue