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

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

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

Entity.setNoGravity介绍

暂无

代码示例

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

@SubscribeEvent
public static void worldTick(TickEvent.WorldTickEvent event) {
  if (event.phase == TickEvent.Phase.START)
    reversals.removeIf((reversal) -> {
      if (reversal.world.get() == event.world) {
        if (reversal.nemez.hasNext()) {
          reversal.nemez.applySnapshot(event.world);
          if (reversal.pos != null && reversal.world.get().getTotalWorldTime() % PacketNemezReversal.SYNC_AMOUNT == 0)
            PacketHandler.NETWORK.sendToAllAround(new PacketNemezReversal(reversal.nemez),
                new NetworkRegistry.TargetPoint(reversal.world.get().provider.getDimension(),
                    reversal.pos.getX() + 0.5, reversal.pos.getY() + 0.5, reversal.pos.getZ() + 0.5, 96));
        } else {
          for (Entity entity : reversal.nemez.getTrackedEntities(event.world))
            entity.setNoGravity(false);
          return true;
        }
      }
      return reversal.world.get() == null;
    });
}

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

public void apply(Entity entity) {
  entity.setNoGravity(true);
  if (x != null) entity.posX = x;
  if (y != null) entity.posY = y;
  if (z != null) entity.posZ = z;
  if (yaw != null) entity.rotationYaw = yaw;
  if (pitch != null) entity.rotationPitch = pitch;
  if (entity instanceof EntityLivingBase) {
    EntityLivingBase living = (EntityLivingBase) entity;
    if (health != null) living.setHealth(health);
    if (entity instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) living;
      if (food != null) player.getFoodStats().setFoodLevel(food);
      if (saturation != null) saturationSetter.invoke(player.getFoodStats(), saturation);
      if (exhaustion != null) exhaustionSetter.invoke(player.getFoodStats(), exhaustion);
    }
  }
}

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

public void apply(Entity entity, EntityMoment nextMoment, float partialTicks) {
  if (partialTicks == 0) {
    apply(entity);
    return;
  }
  entity.setNoGravity(true);
  if (x != null) entity.posX = x + (nextMoment.x != null ? (nextMoment.x - x) * partialTicks : 0);
  if (y != null) entity.posY = y + (nextMoment.y != null ? (nextMoment.y - y) * partialTicks : 0);
  if (z != null) entity.posZ = z + (nextMoment.z != null ? (nextMoment.z - z) * partialTicks : 0);
  if (yaw != null) entity.rotationYaw = yaw +
      (nextMoment.yaw != null ? (((((nextMoment.yaw - yaw) % 360) + 540) % 360) - 180) * partialTicks : 0);
  if (pitch != null)
    entity.rotationPitch = pitch + (nextMoment.pitch != null ? (nextMoment.pitch - pitch) * partialTicks : 0);
  if (entity instanceof EntityLivingBase) {
    EntityLivingBase living = (EntityLivingBase) entity;
    if (health != null)
      living.setHealth(health + (nextMoment.health != null ? (nextMoment.health - health) * partialTicks : 0));
    if (entity instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) living;
      if (food != null)
        player.getFoodStats().setFoodLevel(food + (int) (nextMoment.food != null ? (nextMoment.food - food) * partialTicks : 0));
      if (saturation != null)
        saturationSetter.invoke(player.getFoodStats(), saturation + (nextMoment.saturation != null ? (nextMoment.saturation - saturation) * partialTicks : 0));
      if (exhaustion != null)
        exhaustionSetter.invoke(player.getFoodStats(), exhaustion + (nextMoment.exhaustion != null ? (nextMoment.exhaustion - exhaustion) * partialTicks : 0));
    }
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

Entity e = this.getEntityInSeat(i);
if (e != null) {
  e.setNoGravity(false);
  Entity e = this.getEntityInSeat(i);
  if (e != null) {
    e.setNoGravity(false);

相关文章

Entity类方法