net.minecraft.entity.Entity.setPositionAndRotation()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(138)

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

Entity.setPositionAndRotation介绍

暂无

代码示例

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

private static boolean doTeleport(@Nonnull World world, @Nonnull Entity entity, double targetX, double targetY, double targetZ) {
 if (entity instanceof EntityLivingBase) {
  return doTeleport(world, (EntityLivingBase) entity, targetX, targetY, targetZ);
 }
 if (entity.isRiding()) {
  entity.dismountRidingEntity();
 }
 if (entity.isBeingRidden()) {
  entity.removePassengers();
 }
 entity.setPositionAndRotation(targetX, targetY, targetZ, entity.rotationYaw, entity.rotationPitch);
 return true;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
protected void updateEntityOnPlacement(int turns, BlockPos pos, Entity e) {
  e.setPositionAndRotation(pos.getX() + BlockTools.rotateFloatX(xOffset, zOffset, turns), pos.getY() + yOffset,
      pos.getZ() + BlockTools.rotateFloatZ(xOffset, zOffset, turns), (rotation - 90f * turns) % 360f, 0);
  ((VehicleBase) e).localTurretRotation = (turretRotation - 90f * turns) % 360;
  ((VehicleBase) e).localTurretDestRot = ((VehicleBase) e).localTurretRotation;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

protected void updateEntityOnPlacement(int turns, BlockPos pos, Entity e) {
  e.setPositionAndRotation(pos.getX() + BlockTools.rotateFloatX(xOffset, zOffset, turns), pos.getY() + yOffset,
      pos.getZ() + BlockTools.rotateFloatZ(xOffset, zOffset, turns), (rotation + 90.f * turns) % 360.f, 0);
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

mob.setPositionAndRotation(tX, tY, tZ, mob.rotationYaw, mob.rotationPitch);

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
public void updatePassenger(Entity passenger) {
  double posX = this.posX;
  double posY = this.posY + this.getRiderVerticalOffset();
  double posZ = this.posZ;
  float yaw = this.vehicleType.moveRiderWithTurret() ? localTurretRotation : rotationYaw;
  posX += Trig.sinDegrees(yaw) * -this.getRiderForwardOffset();
  posX += Trig.sinDegrees(yaw + 90) * this.getRiderHorizontalOffset();
  posZ += Trig.cosDegrees(yaw) * -this.getRiderForwardOffset();
  posZ += Trig.cosDegrees(yaw + 90) * this.getRiderHorizontalOffset();
  if (vehicleType.shouldRiderSit()) {
    passenger.height = 1.3f;
  }
  if (passenger instanceof NpcBase) {
    passenger.setPositionAndRotation(posX, posY + passenger.getYOffset(), posZ, 180 - localTurretRotation, passenger.rotationPitch);
    passenger.setRenderYawOffset(180 - localTurretRotation);
  } else {
    passenger.setPosition(posX, posY + passenger.getYOffset(), posZ);
    passenger.rotationYaw -= this.moveHelper.getRotationSpeed();
  }
  if (vehicleType.shouldRiderSit()) {
    passenger.setEntityBoundingBox(passenger.getEntityBoundingBox().offset(0, 0.6, 0));
  }
}

相关文章

Entity类方法