本文整理汇总了Java中net.minecraft.world.World.isBlockIndirectlyGettingPowered方法的典型用法代码示例。如果您正苦于以下问题:Java World.isBlockIndirectlyGettingPowered方法的具体用法?Java World.isBlockIndirectlyGettingPowered怎么用?Java World.isBlockIndirectlyGettingPowered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.isBlockIndirectlyGettingPowered方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateOverlayForPos
import net.minecraft.world.World; //导入方法依赖的package包/类
private void updateOverlayForPos(World world, BlockPos pos, PowerOverlayData overlay) {
if (world.isAirBlock(pos)) {
return;
}
overlay.pos = pos;
overlay.power = world.getStrongPower(overlay.pos);
if (overlay.power == 0) {
overlay.strongPowered = false;
overlay.power = world.isBlockIndirectlyGettingPowered(overlay.pos);
} else {
overlay.strongPowered = true;
}
if (!world.getBlockState(overlay.pos).isOpaqueCube()) {
overlay.power = 0;
}
}
示例2: neighborChanged
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
if (!powered) {
powered = world.isBlockIndirectlyGettingPowered(pos.offset(isTopDoor(state) ? EnumFacing.DOWN : EnumFacing.UP)) > 0;
}
TileEntityPneumaticDoorBase doorBase = getDoorBase(world, pos);
if (!world.isRemote && doorBase != null && doorBase.getPressure() >= PneumaticValues.MIN_PRESSURE_PNEUMATIC_DOOR) {
if (powered != doorBase.wasPowered) {
doorBase.wasPowered = powered;
doorBase.setOpening(powered);
}
}
}
示例3: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (world.isBlockIndirectlyGettingPowered(pos) > 0) {
Iterable<BlockPos> poslist = BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, range, range));
Iterator it = poslist.iterator();
while (it.hasNext()) {
BlockPos posit = (BlockPos)it.next();
if (!world.isRemote && !world.isAirBlock(posit)) {
Block loopblock = world.getBlockState(posit).getBlock();
boolean flag = rand.nextInt(10) == 0;
if (loopblock == Blocks.GRASS && flag) {
EntityItemHourglass.setOldBlock(world, posit, UCBlocks.oldGrass); break;
}
if (loopblock == Blocks.COBBLESTONE && flag) {
EntityItemHourglass.setOldBlock(world, posit, UCBlocks.oldCobble); break;
}
if (loopblock == Blocks.MOSSY_COBBLESTONE && flag) {
EntityItemHourglass.setOldBlock(world, posit, UCBlocks.oldCobbleMoss); break;
}
if (loopblock == Blocks.BRICK_BLOCK && flag) {
EntityItemHourglass.setOldBlock(world, posit, UCBlocks.oldBrick); break;
}
if (loopblock == Blocks.GRAVEL && flag) {
EntityItemHourglass.setOldBlock(world, posit, UCBlocks.oldGravel); break;
}
}
}
}
}
示例4: calculateCurrentChanges
import net.minecraft.world.World; //导入方法依赖的package包/类
private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state)
{
IBlockState iblockstate = state;
int i = ((Integer)state.getValue(POWER)).intValue();
int j = 0;
j = this.getMaxCurrentStrength(worldIn, pos2, j);
this.canProvidePower = false;
int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
this.canProvidePower = true;
if (k > 0 && k > j - 1)
{
j = k;
}
int l = 0;
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
BlockPos blockpos = pos1.offset(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
if (flag)
{
l = this.getMaxCurrentStrength(worldIn, blockpos, l);
}
if (worldIn.getBlockState(blockpos).getBlock().isNormalCube() && !worldIn.getBlockState(pos1.up()).getBlock().isNormalCube())
{
if (flag && pos1.getY() >= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
}
}
else if (!worldIn.getBlockState(blockpos).getBlock().isNormalCube() && flag && pos1.getY() <= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
}
}
if (l > j)
{
j = l - 1;
}
else if (j > 0)
{
--j;
}
else
{
j = 0;
}
if (k > j - 1)
{
j = k;
}
if (i != j)
{
state = state.withProperty(POWER, Integer.valueOf(j));
if (worldIn.getBlockState(pos1) == iblockstate)
{
worldIn.setBlockState(pos1, state, 2);
}
this.blocksNeedingUpdate.add(pos1);
for (EnumFacing enumfacing1 : EnumFacing.values())
{
this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
}
}
return state;
}
示例5: calculateCurrentChanges
import net.minecraft.world.World; //导入方法依赖的package包/类
private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state) {
IBlockState iblockstate = state;
int i = ((Integer) state.getValue(POWER)).intValue();
int j = 0;
j = this.getMaxCurrentStrength(worldIn, pos2, j);
this.canProvidePower = false;
int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
this.canProvidePower = true;
if (k > 0 && k > j - 1) {
j = k;
}
int l = 0;
for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
EnumFacing enumfacing = (EnumFacing) enumfacing0;
BlockPos blockpos = pos1.offset(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
if (flag) {
l = this.getMaxCurrentStrength(worldIn, blockpos, l);
}
if (worldIn.getBlockState(blockpos).getBlock().isNormalCube()
&& !worldIn.getBlockState(pos1.up()).getBlock().isNormalCube()) {
if (flag && pos1.getY() >= pos2.getY()) {
l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
}
} else if (!worldIn.getBlockState(blockpos).getBlock().isNormalCube() && flag
&& pos1.getY() <= pos2.getY()) {
l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
}
}
if (l > j) {
j = l - 1;
} else if (j > 0) {
--j;
} else {
j = 0;
}
if (k > j - 1) {
j = k;
}
if (i != j) {
state = state.withProperty(POWER, Integer.valueOf(j));
if (worldIn.getBlockState(pos1) == iblockstate) {
worldIn.setBlockState(pos1, state, 2);
}
this.blocksNeedingUpdate.add(pos1);
for (EnumFacing enumfacing1 : EnumFacing.values()) {
this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
}
}
return state;
}
示例6: calculateCurrentChanges
import net.minecraft.world.World; //导入方法依赖的package包/类
private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state)
{
IBlockState iblockstate = state;
int i = ((Integer)state.getValue(POWER)).intValue();
int j = 0;
j = this.getMaxCurrentStrength(worldIn, pos2, j);
this.canProvidePower = false;
int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
this.canProvidePower = true;
if (k > 0 && k > j - 1)
{
j = k;
}
int l = 0;
for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL)
{
EnumFacing enumfacing = (EnumFacing) enumfacing0;
BlockPos blockpos = pos1.offset(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
if (flag)
{
l = this.getMaxCurrentStrength(worldIn, blockpos, l);
}
if (worldIn.getBlockState(blockpos).getBlock().isNormalCube() && !worldIn.getBlockState(pos1.up()).getBlock().isNormalCube())
{
if (flag && pos1.getY() >= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
}
}
else if (!worldIn.getBlockState(blockpos).getBlock().isNormalCube() && flag && pos1.getY() <= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
}
}
if (l > j)
{
j = l - 1;
}
else if (j > 0)
{
--j;
}
else
{
j = 0;
}
if (k > j - 1)
{
j = k;
}
if (i != j)
{
state = state.withProperty(POWER, Integer.valueOf(j));
if (worldIn.getBlockState(pos1) == iblockstate)
{
worldIn.setBlockState(pos1, state, 2);
}
this.blocksNeedingUpdate.add(pos1);
for (EnumFacing enumfacing1 : EnumFacing.values())
{
this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
}
}
return state;
}
示例7: calculateCurrentChanges
import net.minecraft.world.World; //导入方法依赖的package包/类
private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state)
{
IBlockState iblockstate = state;
int i = ((Integer)state.getValue(POWER)).intValue();
int j = 0;
j = this.getMaxCurrentStrength(worldIn, pos2, j);
this.canProvidePower = false;
int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
this.canProvidePower = true;
if (k > 0 && k > j - 1)
{
j = k;
}
int l = 0;
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
BlockPos blockpos = pos1.offset(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
if (flag)
{
l = this.getMaxCurrentStrength(worldIn, blockpos, l);
}
if (worldIn.getBlockState(blockpos).isNormalCube() && !worldIn.getBlockState(pos1.up()).isNormalCube())
{
if (flag && pos1.getY() >= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l);
}
}
else if (!worldIn.getBlockState(blockpos).isNormalCube() && flag && pos1.getY() <= pos2.getY())
{
l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l);
}
}
if (l > j)
{
j = l - 1;
}
else if (j > 0)
{
--j;
}
else
{
j = 0;
}
if (k > j - 1)
{
j = k;
}
if (i != j)
{
state = state.withProperty(POWER, Integer.valueOf(j));
if (worldIn.getBlockState(pos1) == iblockstate)
{
worldIn.setBlockState(pos1, state, 2);
}
this.blocksNeedingUpdate.add(pos1);
for (EnumFacing enumfacing1 : EnumFacing.values())
{
this.blocksNeedingUpdate.add(pos1.offset(enumfacing1));
}
}
return state;
}
示例8: getRedstoneLevel
import net.minecraft.world.World; //导入方法依赖的package包/类
/**
* Returns the redstone level at the given position. Use this when you don't care what side(s) the signal is
* coming from, just the level of the signal at the position.
*
* @param world the world
* @param pos the position to check
* @return the redstone level
*/
public static int getRedstoneLevel(World world, BlockPos pos) {
return world != null ? world.isBlockIndirectlyGettingPowered(pos) : 0;
}