mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Fix #53; add support for comparators on bins
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user