mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Fix #2037 Add Comparator Support for Engines
This commit is contained in:
1 parent
e3e4a4341d
commit
ebc70ab22a
6 files changed
+71
-33
No files matched your search
@@ -29,8 +29,10 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.energy.EnergyHelper;
|
||||
import forestry.energy.EnergyManager;
|
||||
|
||||
public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
private static final EnumMap<EnumFacing, List<AxisAlignedBB>> boundingBoxesForDirections = new EnumMap<>(EnumFacing.class);
|
||||
@@ -152,4 +154,19 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
return facing.getOpposite() == side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
TileEngine tileEngine = TileUtil.getTile(worldIn, pos, TileEngine.class);
|
||||
if(tileEngine != null){
|
||||
EnergyManager energyManager = tileEngine.getEnergyManager();
|
||||
return energyManager.calculateRedstone();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user