resonant-induction/minecraft/liquidmechanics/common/item/ItemGuage.java
Rseifert 77de6e6353 Making Changes for the better
Starting down the long road of making my mod even more compatable with
other mod's liquids. This will take some time, patience, and pain
killers.

Plan of action
*Release Valve will not store any liquids but rather direction output to
pipes from other TileEntities
*Release Valve will have a gui to restrict it to outputing one or more
types of Liquids that are predefined
*Pipes will go from being fully liquid restricted to color based(0-15)
and have a universal uncolor pipe that can accept all liquids
*Once a pipe is place a tool can be used to change its color just like
in other mods.
*Some colors will be restricted to select liquids for example Blue is
water, Red is Lava, Black is oil, Yellow Fuel, White Milk,
*Steam will have its own pipe made out of bronze to fit the machines it
goes too.
*Tanks will go in the same direction
*Pumps will still be liquid restricted but come with unique textures,
models, and animation per liquid type

Current issues to resolve that are broken with push
*Release valve doesn't work at all due to changes in progress
*back compatable must be added for pipes and old release valves
2013-01-04 19:03:34 -05:00

88 lines
2 KiB
Java

package liquidmechanics.common.item;
import java.util.List;
import liquidmechanics.api.IReadOut;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
public class ItemGuage extends Item
{
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);
}
@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 "guage";
}
@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);
}
}
}
return false;
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch (var3)
{
case 0:
return "PipeGuage";
}
return this.getItemName();
}
}