Java Code Examples for net.minecraft.world.World#getRedstonePower()
The following examples show how to use
net.minecraft.world.World#getRedstonePower() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTUtility.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static int getRedstonePower(World world, BlockPos blockPos, EnumFacing side) { BlockPos offsetPos = blockPos.offset(side); int worldPower = world.getRedstonePower(offsetPos, side); if (worldPower >= 15) { return worldPower; } else { IBlockState offsetState = world.getBlockState(offsetPos); if(offsetState.getBlock() instanceof BlockRedstoneWire) { int wirePower = offsetState.getValue(BlockRedstoneWire.POWER); return Math.max(worldPower, wirePower); } return worldPower; } }
Example 2
Source File: TileRocketFluidLoader.java From AdvancedRocketry with MIT License | 5 votes |
protected boolean getStrongPowerForSides(World world, BlockPos pos) { for(int i = 0; i < 6; i++) { if(sideSelectorModule.getStateForSide(i) == ALLOW_REDSTONEOUT && world.getRedstonePower(pos.offset(EnumFacing.VALUES[i]), EnumFacing.VALUES[i]) > 0) return true; } return false; }
Example 3
Source File: TileRocketLoader.java From AdvancedRocketry with MIT License | 5 votes |
protected boolean getStrongPowerForSides(World world, BlockPos pos) { for(int i = 0; i < 6; i++) { if(sideSelectorModule.getStateForSide(i) == ALLOW_REDSTONEOUT && world.getRedstonePower(pos.offset(EnumFacing.VALUES[i]), EnumFacing.VALUES[i]) > 0) return true; } return false; }
Example 4
Source File: BlockMinecoprocessor.java From Minecoprocessors with GNU General Public License v3.0 | 4 votes |
protected static int calculateInputStrength(World worldIn, BlockPos pos, EnumFacing enumfacing) { IBlockState adjacentState = worldIn.getBlockState(pos); Block block = adjacentState.getBlock(); int i = worldIn.getRedstonePower(pos, enumfacing); if (i >= 15) { return 15; } int redstoneWirePower = 0; if (block == Blocks.REDSTONE_WIRE) { redstoneWirePower = adjacentState.getValue(BlockRedstoneWire.POWER); } return Math.max(i, redstoneWirePower); }