net.minecraft.util.math.BlockPos.toImmutable()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中net.minecraft.util.math.BlockPos.toImmutable()方法的一些代码示例,展示了BlockPos.toImmutable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockPos.toImmutable()方法的具体详情如下:
包路径:net.minecraft.util.math.BlockPos
类名称:BlockPos
方法名:toImmutable

BlockPos.toImmutable介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Override
public void setCollidedAt(BlockPos pos) {
  if(!hasAlreadyCollidedAt(pos))
    alreadyCollidedAt.add(pos.toImmutable());
}

代码示例来源:origin: SleepyTrousers/EnderIO

public void setParentPos(BlockPos pos) {
 parent = pos.toImmutable();
}

代码示例来源:origin: GregTechCE/GregTech

public BlockPos getPos() {
  return this.pos.toImmutable();
}

代码示例来源:origin: gegy1000/Terrarium

protected boolean tryPlace(Random random, BlockPos pos, int localX, int localZ) {
  if (this.intersectionRange > 0) {
    if (this.checkHorizontalIntersection(pos)) {
      return false;
    }
    this.intersectionPoints.add(pos.toImmutable());
  }
  return true;
}

代码示例来源:origin: Vazkii/Psi

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
  TileEntity inWorld = worldIn.getTileEntity(pos);
  if (inWorld instanceof TileConjured)
    needsParticleUpdate.add(pos.toImmutable());
}

代码示例来源:origin: SquidDev-CC/plethora

public WorldLocation(@Nonnull World world, @Nonnull BlockPos pos) {
  Preconditions.checkNotNull(world, "world cannot be null");
  Preconditions.checkNotNull(pos, "pos cannot be null");
  this.world = world;
  this.pos = pos.toImmutable();
  this.loc = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
}

代码示例来源:origin: SleepyTrousers/EnderIO

public void registerCharger(@Nonnull IWirelessCharger charger) {
 getChargersForWorld(charger.getworld()).add(charger.getLocation().toImmutable());
 changeCount++;
}

代码示例来源:origin: SleepyTrousers/EnderIO

private SolarPanelNetwork(@Nonnull TileSolarPanel panel) {
 this.world = panel.getWorld();
 this.valid = true;
 panels.add(panel.getPos().toImmutable());
 panel.setNetwork(this);
 nextCollectTick = 0;
 cleanupMemberlist();
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public TileEntity getTileEntity(@Nonnull BlockPos pos) {
 IBlockState paintSource = getPaintSource(pos);
 if (paintSource != null && paintSource != super.getBlockState(pos)) {
  return createTileEntity(paintSource, pos.toImmutable());
 }
 return super.getTileEntity(pos);
}

代码示例来源:origin: Vazkii/Patchouli

@Override
@Nullable
public TileEntity getTileEntity(BlockPos pos) {
  IBlockState state = getBlockState(pos);
  if (state.getBlock().hasTileEntity(state)) {
    return teCache.computeIfAbsent(pos.toImmutable(), p -> state.getBlock().createTileEntity(world, state));
  }
  return null;
}

代码示例来源:origin: sinkillerj/ProjectE

public static void igniteNearby(World world, EntityPlayer player)
{
  for (BlockPos pos : BlockPos.getAllInBoxMutable(new BlockPos(player).add(-8, -5, -8), new BlockPos(player).add(8, 5, 8)))
  {
    if (world.rand.nextInt(128) == 0 && world.isAirBlock(pos))
    {
      PlayerHelper.checkedPlaceBlock(((EntityPlayerMP) player), pos.toImmutable(), Blocks.FIRE.getDefaultState());
    }
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

TileEntity tileEntity = world.getTileEntity(candidate);
if (tileEntity instanceof TileSolarPanel && !tileEntity.isInvalid() && tileEntity.hasWorld()) {
 panels.add(candidate.toImmutable());
 final ISolarPanelNetwork otherNetwork = ((TileSolarPanel) tileEntity).network;
 if (otherNetwork != this) {

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

pos = pos.toImmutable(); // Forge - prevent mutable BlockPos leaks

代码示例来源:origin: sinkillerj/ProjectE

private boolean useBoneMeal(World world, BlockPos pos)
{
  boolean result = false;
  for (BlockPos currentPos : BlockPos.getAllInBoxMutable(pos.add(-15, 0, -15), pos.add(15, 0, 15)))
  {
    IBlockState state = world.getBlockState(currentPos);
    Block crop = state.getBlock();
    if (crop instanceof IGrowable)
    {
      IGrowable growable = (IGrowable) crop;
      if (growable.canUseBonemeal(world, world.rand, currentPos, state))
      {
        if (!result)
        {
          result = true;
        }
        growable.grow(world, world.rand, currentPos.toImmutable(), state);
      }
    }
  }
  return result;
}

代码示例来源:origin: sinkillerj/ProjectE

PlayerHelper.checkedPlaceBlock(((EntityPlayerMP) player), pos.toImmutable(), Blocks.FIRE.getDefaultState());
PlayerHelper.checkedPlaceBlock(((EntityPlayerMP) player), pos.toImmutable(), Blocks.FIRE.getDefaultState());

代码示例来源:origin: SleepyTrousers/EnderIO

if (capturedMob != null) {
   ItemStack drop = capturedMob.toStack(ModObject.itemBrokenSpawner.getItemNN(), 0, 1);
   dropCache.put(evt.getPos().toImmutable(), drop);
   dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());
dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());

代码示例来源:origin: TeamWizardry/Wizardry

range))) {
IBlockState state = entitySource.world.getBlockState(pos);
if (state.isFullCube()) entitySource.world.playEvent(2001, pos.toImmutable(), Block.getStateId(state));

代码示例来源:origin: SleepyTrousers/EnderIO

if (Prep.isValid(stack)) {
 evt.getDrops().add(stack);
 dropCache.put(evt.getPos().toImmutable(), Prep.getEmpty());

代码示例来源:origin: Chisel-Team/Chisel

@SuppressWarnings("null")
@SubscribeEvent
public void onLavaLakes(PopulateChunkEvent.Post event) {
  if (Configurations.basaltSpecialGen && Features.BASALT.enabled()) {
    BlockPos origin = new BlockPos(event.getChunkX() * 16 + 8, 0, event.getChunkZ() * 16 + 8);
    for (BlockPos pos : BlockPos.getAllInBoxMutable(origin, origin.add(15, 11, 15))) {
      IBlockState here = event.getWorld().getBlockState(pos);
      if (here.getMaterial() == Material.LAVA) {
        BlockPos p = pos.toImmutable();
        World w = event.getWorld();
        int size = Configurations.basaltSideThickness;
        for (BlockPos p2 : BlockPos.getAllInBoxMutable(p.offset(EnumFacing.EAST, size).offset(EnumFacing.SOUTH, size), p.offset(EnumFacing.WEST, size).offset(EnumFacing.NORTH, size))) {
          replace(w, p2);
        }
        for (int i = 1; i <= Configurations.basaltBottomThickness; i++) {
          replace(w, p.offset(EnumFacing.DOWN, i));
        }
      }
    }
  }
}

相关文章