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

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

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

BlockPos.getY介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

public static BlockVector3 adapt(BlockPos pos) {
  return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ());
}

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

@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
  if(rand.nextBoolean())
    Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}

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

@Override
public void addCollisionBoxToList(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB par5AxisAlignedBB, @Nonnull List<AxisAlignedBB> stacks, Entity par7Entity, boolean isActualState) {
  PlatformVariant variant = state.getValue(BotaniaStateProps.PLATFORM_VARIANT);
  if(variant == PlatformVariant.INFRANGIBLE || variant == PlatformVariant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + 0.9 && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
    super.addCollisionBoxToList(state, world, pos, par5AxisAlignedBB, stacks, par7Entity, isActualState);
}

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

@Override
public void recieveMana(int mana) {
  if(mana > 0)
    for(int i = 0; i < 10; i++)
      Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
}

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

public void rotate(double angle) {
  double x = relPos.getX();
  double z = relPos.getZ();
  double sin = Math.sin(angle);
  double cos = Math.cos(angle);
  double xn = x * cos - z * sin;
  double zn = x * sin + z * cos;
  relPos = new BlockPos((int) Math.round(xn), relPos.getY(), (int) Math.round(zn));
}

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

private void blockParticle(AlfPortalState state) {
  int i = world.rand.nextInt(AIR_POSITIONS.length);
  double[] pos = new double[] {
      AIR_POSITIONS[i].getX() + 0.5F, AIR_POSITIONS[i].getY() + 0.5F, AIR_POSITIONS[i].getZ() + 0.5F
  };
  if(state == AlfPortalState.ON_X)
    pos = CONVERTER_X_Z_FP.apply(pos);
  float motionMul = 0.2F;
  Botania.proxy.wispFX(getPos().getX() + pos[0], getPos().getY() + pos[1], getPos().getZ() + pos[2], (float) (Math.random() * 0.25F), (float) (Math.random() * 0.5F + 0.5F), (float) (Math.random() * 0.25F), (float) (Math.random() * 0.15F + 0.1F), (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul);
}

代码示例来源:origin: EngineHub/WorldEdit

Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());

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

private boolean inRange(BlockPos pos, BlockPos srcPos, int range, double heightscale, boolean pointy) {
  if(pos.getY() >= srcPos.getY())
    return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range;
  else if(!pointy)
    return MathHelper.pointDistanceSpace(pos.getX(), pos.getY() / heightscale, pos.getZ(), srcPos.getX(), srcPos.getY() / heightscale, srcPos.getZ()) < range;
  else return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range - (srcPos.getY() - pos.getY()) / heightscale;
}

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

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
  state = getActualState(state, world, pos);
  int hex = state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getColorValue();
  int r = (hex & 0xFF0000) >> 16;
  int g = (hex & 0xFF00) >> 8;
  int b = hex & 0xFF;
  if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
    Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}

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

public Vector3 getMovementVector() {
  BlockPos dest = getNextDestination();
  if(dest == null)
    return null;
  return new Vector3(dest.getX() - pos.getX(), dest.getY() - pos.getY(), dest.getZ() - pos.getZ());
}

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

@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
  TileEntity tile = world.getTileEntity(pos);
  if(!(tile instanceof TileSpreader))
    return;
  TileSpreader inv = (TileSpreader) tile;
  if(inv.paddingColor != -1) {
    net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Blocks.WOOL, 1, inv.paddingColor));
  }
  InventoryHelper.dropInventory(inv, world, state, pos);
  super.breakBlock(world, pos, state);
}

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

@Override
@SideOnly(Side.CLIENT)
public BlockPos getBinding() {
  return Minecraft.getMinecraft().player.isSneaking() && bindPos.getY() != -1 ? bindPos : super.getBinding();
}

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

@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
  TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
  if(!enchanter.itemToEnchant.isEmpty()) {
    world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
  }
  world.updateComparatorOutputLevel(pos, state.getBlock());
  super.breakBlock(world, pos, state);
}

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

@Override
protected void writeEntityToNBT(@Nonnull NBTTagCompound cmp) {
  BlockPos exit = getExitPos();
  cmp.setInteger(TAG_EXIT_X, exit.getX());
  cmp.setInteger(TAG_EXIT_Y, exit.getY());
  cmp.setInteger(TAG_EXIT_Z, exit.getZ());
}

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

private void keepInsideArena(EntityPlayer player) {
  if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= ARENA_RANGE) {
    Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5);
    Vector3 playerVector = Vector3.fromEntityCenter(player);
    Vector3 motion = sourceVector.subtract(playerVector).normalize();
    player.motionX = motion.x;
    player.motionY = 0.2;
    player.motionZ = motion.z;
    player.velocityChanged = true;
  }
}

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

@Override
public void writePacketNBT(NBTTagCompound cmp) {
  cmp.setInteger(TAG_BIND_X, bindPos.getX());
  cmp.setInteger(TAG_BIND_Y, bindPos.getY());
  cmp.setInteger(TAG_BIND_Z, bindPos.getZ());
}

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

/**
   * Returns the multiblock component for the coordinates, adjusted based on the anchor
   */
  private MultiblockComponent getComponent(BlockPos pos) {
    return multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ())));
  }
}

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

@Override
public RadiusDescriptor getRadius() {
  AxisAlignedBB aabb = aabbForOrientation();
  aabb = new AxisAlignedBB(aabb.minX, supertile.getPos().getY(), aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
  return new RadiusDescriptor.Rectangle(toBlockPos(), aabb);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public long getSortValue()
{
  final TileEntity te = this.iHost.getTileEntity();
  return ( te.getPos().getZ() << 24 ) ^ ( te.getPos().getX() << 8 ) ^ te.getPos().getY();
}

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

public static void dropInventory(TileSimpleInventory inv, World world, IBlockState state, BlockPos pos) {
  if(inv != null) {
    for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
      ItemStack itemstack = inv.getItemHandler().getStackInSlot(j1);
      if(!itemstack.isEmpty()) {
        net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemstack);
      }
    }
    world.updateComparatorOutputLevel(pos, state.getBlock());
  }
}

相关文章