コード例 #1
0
 public void handleEntityVelocity(Packet28EntityVelocity var1) {
   Entity var2 = this.getEntityByID(var1.entityId);
   if (var2 != null) {
     var2.setVelocity(
         (double) var1.motionX / 8000.0D,
         (double) var1.motionY / 8000.0D,
         (double) var1.motionZ / 8000.0D);
   }
 }
コード例 #2
0
  public void handleVehicleSpawn(Packet23VehicleSpawn var1) {
    double var2 = (double) var1.xPosition / 32.0D;
    double var4 = (double) var1.yPosition / 32.0D;
    double var6 = (double) var1.zPosition / 32.0D;
    Object var8 = null;
    if (var1.type == 10) {
      var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 0);
    }

    if (var1.type == 11) {
      var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 1);
    }

    if (var1.type == 12) {
      var8 = new EntityMinecart(this.worldClient, var2, var4, var6, 2);
    }

    if (var1.type == 90) {
      var8 = new EntityFish(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 60) {
      var8 = new EntityArrow(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 61) {
      var8 = new EntitySnowball(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 63) {
      var8 =
          new EntityFireball(
              this.worldClient,
              var2,
              var4,
              var6,
              (double) var1.field_28047_e / 8000.0D,
              (double) var1.field_28046_f / 8000.0D,
              (double) var1.field_28045_g / 8000.0D);
      var1.field_28044_i = 0;
    }

    if (var1.type == 62) {
      var8 = new EntityEgg(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 1) {
      var8 = new EntityBoat(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 50) {
      var8 = new EntityTNTPrimed(this.worldClient, var2, var4, var6);
    }

    if (var1.type == 70) {
      var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, Block.sand.blockID);
    }

    if (var1.type == 71) {
      var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, Block.gravel.blockID);
    }

    if (var8 != null) {
      ((Entity) var8).serverPosX = var1.xPosition;
      ((Entity) var8).serverPosY = var1.yPosition;
      ((Entity) var8).serverPosZ = var1.zPosition;
      ((Entity) var8).rotationYaw = 0.0F;
      ((Entity) var8).rotationPitch = 0.0F;
      ((Entity) var8).entityId = var1.entityId;
      this.worldClient.func_712_a(var1.entityId, (Entity) var8);
      if (var1.field_28044_i > 0) {
        if (var1.type == 60) {
          Entity var9 = this.getEntityByID(var1.field_28044_i);
          if (var9 instanceof EntityLiving) {
            ((EntityArrow) var8).shootingEntity = (EntityLiving) var9;
          }
        }

        ((Entity) var8)
            .setVelocity(
                (double) var1.field_28047_e / 8000.0D,
                (double) var1.field_28046_f / 8000.0D,
                (double) var1.field_28045_g / 8000.0D);
      }
    }
  }