Java Code Examples for net.minecraft.world.World.getRedstonePower()

The following are Jave code examples for showing how to use getRedstonePower() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 2
Project: DecompiledMinecraft   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 3
Project: BaseClient   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 4
Project: BaseClient   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 5
Project: Backmemed   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.REDSTONE_WIRE ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 6
Project: CustomWorldGen   File: BlockRedstoneDiode.java   View Source Code Vote up 6 votes
protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing);
    int i = worldIn.getRedstonePower(blockpos, enumfacing);

    if (i >= 15)
    {
        return i;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(blockpos);
        return Math.max(i, iblockstate.getBlock() == Blocks.REDSTONE_WIRE ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0);
    }
}
 
Example 7
Project: uniquecrops   File: GrowthSteps.java   View Source Code Vote up 5 votes
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	for (EnumFacing facing : EnumFacing.VALUES) {
		int powersignal = world.getRedstonePower(pos.offset(facing), facing);
		if (powersignal >= 8)
			return true;
	}
	return false;
}
 
Example 8
Project: Minecoprocessors   File: BlockMinecoprocessor.java   View Source Code Vote up 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);

}
 
Example 9
Project: pnc-repressurized   File: PneumaticCraftUtils.java   View Source Code Vote up 2 votes
/**
 * Returns the redstone level for the given face at the given position.  Use this to check redstone signal level
 * on a specific face of a block.
 *
 * @param world the world
 * @param pos the position
 * @param face the face to check
 * @return the redstone level
 */
public static int getRedstoneLevel(World world, BlockPos pos, EnumFacing face) {
    return world.getRedstonePower(pos, face);
}