fix some blocks crashing on explosion
This commit is contained in:
@@ -4,6 +4,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import storagecraft.StorageCraftBlocks;
|
||||
import storagecraft.block.BlockCable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,10 +34,15 @@ public class TileCable extends TileBase
|
||||
}
|
||||
|
||||
public boolean isSensitiveCable()
|
||||
{
|
||||
if (worldObj.getBlockState(pos).getBlock() == StorageCraftBlocks.CABLE)
|
||||
{
|
||||
return (Boolean) worldObj.getBlockState(pos).getValue(BlockCable.SENSITIVE);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if (isSensitiveCable())
|
||||
|
@@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import storagecraft.StorageCraft;
|
||||
import storagecraft.StorageCraftBlocks;
|
||||
import storagecraft.block.BlockController;
|
||||
import storagecraft.block.EnumControllerType;
|
||||
@@ -115,7 +116,8 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
}
|
||||
}
|
||||
|
||||
switch (getType()){
|
||||
switch (getType())
|
||||
{
|
||||
case NORMAL:
|
||||
energy.extractEnergy(energyUsage, false);
|
||||
break;
|
||||
@@ -124,16 +126,23 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
break;
|
||||
}
|
||||
|
||||
if (lastEnergy != energy.getEnergyStored()) {
|
||||
if (lastEnergy != energy.getEnergyStored())
|
||||
{
|
||||
worldObj.updateComparatorOutputLevel(pos, StorageCraftBlocks.CONTROLLER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnumControllerType getType() {
|
||||
public EnumControllerType getType()
|
||||
{
|
||||
if (worldObj.getBlockState(pos).getBlock() == StorageCraftBlocks.CONTROLLER)
|
||||
{
|
||||
return (EnumControllerType) worldObj.getBlockState(pos).getValue(BlockController.TYPE);
|
||||
}
|
||||
|
||||
return EnumControllerType.NORMAL;
|
||||
}
|
||||
|
||||
public void onDestroyed()
|
||||
{
|
||||
disconnectAll();
|
||||
|
Reference in New Issue
Block a user