Fix #53; add support for comparators on bins

This commit is contained in:
Dave Smith committed 2019-03-20 15:50:33 -06:00
1 parent ccd7ed019a
commit a4e453e7d5
2 files changed
+36 -1

No files matched your search

@@ -818,4 +818,23 @@ public abstract class BlockBasic extends Block {
public boolean isBeaconBase(IBlockAccess world, BlockPos pos, BlockPos beacon) {
return BasicBlockType.get(world.getBlockState(pos)).isBeaconBase;
}
@Override
public boolean hasComparatorInputOverride(IBlockState blockState) {
return BasicBlockType.get(blockState).hasRedstoneOutput;
}
@Override
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
if (BasicBlockType.get(blockState).hasRedstoneOutput) {
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityBin) {
TileEntityBin binTile = (TileEntityBin)tile;
float percentFull = binTile.getItemCount() / (binTile.getMaxStoredCount() * 1.0f);
return (int)(percentFull * 15);
}
}
return 0;
}
}