Fixed Crash with valve and redstone

Also due to an F up i redownloaded some files to correct me trying to
remove the unkown liquid. I forgot i used that to prevent null errors,
and since i'll changing over system soon there is no point in correcting
it.
This commit is contained in:
Rseifert 2013-02-23 18:10:07 -05:00
parent 87308ec86b
commit ca66742d6b

View file

@ -31,12 +31,6 @@ public class BlockReleaseValve extends BlockMachine
return new TileEntityReleaseValve();
}
@Override
public void onBlockAdded(World par1World, int x, int y, int z)
{
this.checkForPower(par1World, x, y, z);
}
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
{
@ -83,7 +77,6 @@ public class BlockReleaseValve extends BlockMachine
public void onNeighborBlockChange(World par1World, int x, int y, int z, int side)
{
super.onNeighborBlockChange(par1World, x, y, z, side);
this.checkForPower(par1World, x, y, z);
}
@ -92,24 +85,4 @@ public class BlockReleaseValve extends BlockMachine
{
return new ItemStack(FluidMech.blockReleaseValve, 1, 0);
}
public static void checkForPower(World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityReleaseValve)
{
boolean powered = ((TileEntityReleaseValve) tileEntity).isPowered;
boolean beingPowered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockGettingPowered(x, y, z);
if (powered && !beingPowered)
{
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOff();
}
else if (!powered && beingPowered)
{
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOn();
}
}
}
}