5787f65148
Did some file changes to make finding things easier Added: Custom creative tab Changed: File root system, :p to many files Changed: Tank liquid trade method to balance out instead of full trade Changed: the packet update rate of the Tank to try to fix Render Lag Fixed: Tank Render so Liquid levels can be seen BugIgnorable: uneven levels of liquid will not show up on tank render but are present BugIgnorable: eValve names sometime glitch and call all instances Empty XXX TODO: Fix Textures, and add model for eValve TODO: Finish One way valve TODO: Finish OIL,STEAM,FUEL liquid/gas blocks
72 lines
1.4 KiB
Java
72 lines
1.4 KiB
Java
package dark.BasicUtilities.Tile;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import dark.BasicUtilities.api.Liquid;
|
|
import dark.BasicUtilities.api.MHelper;
|
|
|
|
public class TileEntityValve extends TileEntity{
|
|
Liquid type = Liquid.DEFUALT;
|
|
int liquidStored = 0;
|
|
int lMax = 1;
|
|
int tickCount = 0;
|
|
TileEntity[] connected = {null,null,null,null,null,null};
|
|
public boolean on = false;
|
|
@Override
|
|
public void updateEntity()
|
|
{
|
|
tickCount++;
|
|
if(tickCount >= 10)
|
|
{
|
|
int deltaX = 0;
|
|
int deltaZ = 0;
|
|
int deltaY = 0;
|
|
int facing = 0;
|
|
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
|
if(meta == 0 && meta == 8)
|
|
{
|
|
facing = 2;
|
|
}
|
|
if(meta == 1 && meta == 9)
|
|
{
|
|
facing = 5;
|
|
}
|
|
if(meta == 2 && meta == 10)
|
|
{
|
|
facing = 3;
|
|
}
|
|
if(meta == 3 && meta == 11)
|
|
{
|
|
facing = 4;
|
|
}
|
|
if((meta > 3 && meta < 8)&&(meta> 11 && meta < 16))
|
|
{
|
|
facing = 0;
|
|
}
|
|
switch(facing)
|
|
{
|
|
case 0: deltaY++;break;
|
|
case 1: deltaY--;break;
|
|
case 2: deltaZ--;break;
|
|
case 5: deltaZ++;break;
|
|
case 3: deltaX--;break;
|
|
case 4: deltaX++;break;
|
|
}
|
|
|
|
connected = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
|
|
for(int i = 0;i<6;i++)
|
|
{
|
|
if(!(connected[i] instanceof TileEntityPipe))
|
|
{
|
|
connected[i] = null;
|
|
}
|
|
}
|
|
if(!worldObj.isRemote)
|
|
{
|
|
//TODO send packet
|
|
}
|
|
tickCount = 0;
|
|
}
|
|
}
|
|
|
|
|
|
}
|