当前位置: 首页>>代码示例>>Java>>正文


Java World.isBlockIndirectlyGettingPowered方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:ToroCraft,项目名称:PowerProbe,代码行数:17,代码来源:PowerOverlayRender.java

示例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);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:15,代码来源:BlockPneumaticDoor.java

示例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;
			}
		}
	}
}
  }
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:31,代码来源:BlockHourglass.java

示例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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:78,代码来源:BlockRedstoneWire.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:64,代码来源:BlockRedstoneWire.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:79,代码来源:BlockRedstoneWire.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:78,代码来源:BlockRedstoneWire.java

示例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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:PneumaticCraftUtils.java


注:本文中的net.minecraft.world.World.isBlockIndirectlyGettingPowered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。