本文整理了Java中net.minecraft.world.World.getRedstonePower()
方法的一些代码示例,展示了World.getRedstonePower()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getRedstonePower()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getRedstonePower
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public void update() {
boolean redstone = false;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = world.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0)
redstone = true;
}
if(!redstone) {
TileEntity tile = world.getTileEntity(pos.up());
if(tile instanceof TileSpreader) {
TileSpreader spreader = (TileSpreader) tile;
spreader.rotationX += speed * (backwards ? -1 : 1);
if(spreader.rotationX >= 360F)
spreader.rotationX -= 360F;
if(!world.isRemote)
spreader.checkForReceiver();
}
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
linkPool();
if(linkedPool != null && isValidBinding()) {
IManaPool pool = (IManaPool) linkedPool;
int manaInPool = pool.getCurrentMana();
int manaMissing = getMaxMana() - mana;
int manaToRemove = Math.min(manaMissing, manaInPool);
pool.recieveMana(-manaToRemove);
addMana(manaToRemove);
}
if(acceptsRedstone()) {
redstoneSignal = 0;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = supertile.getWorld().getRedstonePower(supertile.getPos().offset(dir), dir);
redstoneSignal = Math.max(redstoneSignal, redstoneSide);
}
}
if(supertile.getWorld().isRemote) {
double particleChance = 1F - (double) mana / (double) getMaxMana() / 3.5F;
Color color = new Color(getColor());
if(Math.random() > particleChance)
BotaniaAPI.internalHandler.sparkleFX(supertile.getWorld(), supertile.getPos().getX() + 0.3 + Math.random() * 0.5, supertile.getPos().getY() + 0.5 + Math.random() * 0.5, supertile.getPos().getZ() + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void update() {
if (world.isRemote)
return;
boolean redstone = false;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = world.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0) {
redstone = true;
break;
}
}
if(canEject()) {
ItemStack stack = itemHandler.getStackInSlot(0);
if(!stack.isEmpty())
eject(stack, redstone);
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void update() {
enabled = true;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = world.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0) {
enabled = false;
break;
}
}
ItemStack stack = itemHandler.getStackInSlot(0);
if(!stack.isEmpty() && stack.getItem() instanceof IAvatarWieldable) {
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
wieldable.onAvatarUpdate(this, stack);
}
if(enabled)
ticksElapsed++;
}
代码示例来源:origin: Vazkii/Botania
hasRedstone = false;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = world.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0) {
hasRedstone = true;
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public int getRedstonePower(@Nonnull BlockPos pos, @Nonnull EnumFacing facing) {
return wrapped.getRedstonePower(pos, facing);
}
代码示例来源:origin: Vazkii/Botania
redstoneSignal = 0;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = supertile.getWorld().getRedstonePower(supertile.getPos().offset(dir), dir);
redstoneSignal = Math.max(redstoneSignal, redstoneSide);
代码示例来源:origin: TheGreyGhost/MinecraftByExample
public int getPowerLevelClient() {
// int powerLevel = this.worldObj.isBlockIndirectlyGettingPowered(this.pos); // if input can come from any side, use this line
int maxPowerFound = 0;
for (EnumFacing whichFace : EnumFacing.HORIZONTALS) {
BlockPos neighborPos = pos.offset(whichFace);
int powerLevel = this.world.getRedstonePower(neighborPos, whichFace);
maxPowerFound = Math.max(powerLevel, maxPowerFound);
}
return maxPowerFound;
}
代码示例来源:origin: TheGreyGhost/MinecraftByExample
private int getPowerLevelInput(World world, BlockPos pos) {
// int powerLevel = world.isBlockIndirectlyGettingPowered(pos); // if input can come from any side, use this line
int maxPowerFound = 0;
for (EnumFacing whichFace : EnumFacing.HORIZONTALS) {
BlockPos neighborPos = pos.offset(whichFace);
int powerLevel = world.getRedstonePower(neighborPos, whichFace);
maxPowerFound = Math.max(powerLevel, maxPowerFound);
}
return maxPowerFound;
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public int getRedstonePower(BlockPos pos, EnumFacing facing) {
return getActualWorld().getRedstonePower(pos, facing);
}
代码示例来源:origin: McJtyMods/RFToolsControl
private int getInputStrength(World world, BlockPos pos, EnumFacing side) {
return world.getRedstonePower(pos.offset(side), side);
}
代码示例来源:origin: McJtyMods/RFToolsControl
private int getInputStrength(World world, BlockPos pos, EnumFacing side) {
return world.getRedstonePower(pos.offset(side), side);
}
代码示例来源:origin: Vazkii/Botania
int redstoneSide = world.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0)
redstone = true;
代码示例来源:origin: MightyPirates/TIS-3D
/**
* Compute the <em>accumulative</em> redstone power applied to the controller.
*
* @return the accumulative redstone signal.
*/
private int computePower() {
int acc = 0;
for (final EnumFacing facing : EnumFacing.VALUES) {
acc += Math.max(0, Math.min(15, getWorld().getRedstonePower(getPos().offset(facing), facing)));
}
return acc;
}
代码示例来源:origin: Vazkii/Quark
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);
}
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Override
public int getRedstoneStrength() {
return world.getRedstonePower(pos.offset(getDirection()), getDirection());
}
代码示例来源:origin: McJtyMods/RFToolsControl
@Override
public int readRedstoneIn(@Nonnull BlockSide side) {
EnumFacing facing = side.getSide();
BlockPos p = getAdjacentPosition(side);
if (p == null) {
return 0;
}
return getWorld().getRedstonePower(p.offset(facing), facing);
}
代码示例来源:origin: SleepyTrousers/EnderIO
public static int isBlockIndirectlyGettingPoweredIfLoaded(@Nonnull World world, @Nonnull BlockPos pos) {
int i = 0;
NNIterator<EnumFacing> iterator = NNList.FACING.iterator();
while (iterator.hasNext()) {
EnumFacing enumfacing = iterator.next();
final BlockPos offset = pos.offset(enumfacing);
if (world.isBlockLoaded(offset)) {
int j = world.getRedstonePower(offset, enumfacing);
if (j >= 15) {
return 15;
}
if (j > i) {
i = j;
}
}
}
return i;
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public boolean cancelTask(IFarmLogic logic, FarmDirection direction) {
for (EnumFacing facing : new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, direction.getFacing()}) {
BlockPos pos = tile.getPos();
World world = tile.getWorldObj();
IBlockState blockState = world.getBlockState(pos.offset(facing));
if (!(blockState.getBlock() instanceof BlockFarm) && world.getRedstonePower(pos, facing) > 0) {
return true;
}
}
return false;
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
protected int getExternalPowerLevel(@Nonnull EnumFacing dir) {
World world = getBundle().getBundleworld();
BlockPos loc = getBundle().getLocation().offset(dir);
int res = 0;
if (world.isBlockLoaded(loc)) {
int strong = world.getStrongPower(loc, dir);
if (strong > 0) {
return strong;
}
res = world.getRedstonePower(loc, dir);
IBlockState bs = world.getBlockState(loc);
Block block = bs.getBlock();
if (res <= 15 && block == Blocks.REDSTONE_WIRE) {
int wireIn = bs.getValue(BlockRedstoneWire.POWER);
res = Math.max(res, wireIn);
}
}
return res;
}
内容来源于网络,如有侵权,请联系作者删除!