fix detector

This commit is contained in:
Raoul Van den Berge
2016-01-01 23:40:13 +01:00
parent c245da1deb
commit 811035d17a
2 changed files with 20 additions and 2 deletions

View File

@@ -47,6 +47,21 @@ public class BlockDetector extends BlockMachine
return new TileDetector(); return new TileDetector();
} }
public int isProvidingWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side)
{
return ((TileDetector) world.getTileEntity(pos)).isPowered() ? 15 : 0;
}
public int isProvidingStrongPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side)
{
return ((TileDetector) world.getTileEntity(pos)).isPowered() ? 15 : 0;
}
public boolean canProvidePower()
{
return true;
}
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{ {

View File

@@ -101,7 +101,8 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
if (powered != lastPowered) if (powered != lastPowered)
{ {
worldObj.notifyBlockOfStateChange(pos, StorageCraftBlocks.DETECTOR); // @TODO: redstone update worldObj.markBlockForUpdate(pos);
worldObj.notifyNeighborsOfStateChange(pos, StorageCraftBlocks.DETECTOR);
} }
} }
} }
@@ -195,8 +196,10 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
powered = buf.readBoolean(); powered = buf.readBoolean();
if (powered != lastPowered) { if (powered != lastPowered)
{
worldObj.markBlockForUpdate(pos); worldObj.markBlockForUpdate(pos);
worldObj.notifyNeighborsOfStateChange(pos, StorageCraftBlocks.DETECTOR);
} }
} }