public void m() {
    super.m();
    if (this.bs > 0) {
      --this.bs;
    }

    if (this.bt > 0) {
      --this.bt;
    }

    if (this.v * this.v + this.x * this.x > 2.500000277905201E-7D && this.random.nextInt(5) == 0) {
      int var1 = MathHelper.floor(this.s);
      int var2 = MathHelper.floor(this.t - 0.20000000298023224D);
      int var3 = MathHelper.floor(this.u);
      IBlockData var4 = this.o.getType(new BlockPosition(var1, var2, var3));
      Block var5 = var4.getBlock();
      if (var5.getMaterial() != Material.AIR) {
        this.o.a(
            class_cy.L,
            this.s + ((double) this.random.nextFloat() - 0.5D) * (double) this.J,
            this.aT().yMin + 0.1D,
            this.u + ((double) this.random.nextFloat() - 0.5D) * (double) this.J,
            4.0D * ((double) this.random.nextFloat() - 0.5D),
            0.5D,
            ((double) this.random.nextFloat() - 0.5D) * 4.0D,
            new int[] {Block.getCombinedId(var4)});
      }
    }
  }
Exemple #2
0
  protected void Z() {
    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locY - 0.20000000298023224D);
    int k = MathHelper.floor(this.locZ);
    BlockPosition blockposition = new BlockPosition(i, j, k);
    IBlockData iblockdata = this.world.getType(blockposition);
    Block block = iblockdata.getBlock();

    if (block.b() != -1) {
      this.world.addParticle(
          EnumParticle.BLOCK_CRACK,
          this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width,
          this.getBoundingBox().b + 0.1D,
          this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width,
          -this.motX * 4.0D,
          1.5D,
          -this.motZ * 4.0D,
          new int[] {Block.getCombinedId(iblockdata)});
    }
  }
 public void setDisplayBlock(IBlockData var1) {
   this.getDataWatcher().watch(20, Integer.valueOf(Block.getCombinedId(var1)));
   this.a(true);
 }
  private Packet<?> e() {
    if (this.tracker.dead) {
      // CraftBukkit start - Remove useless error spam, just return
      // EntityTrackerEntry.d.warn("Fetching addPacket for removed entity");
      return null;
      // CraftBukkit end
    }

    if (this.tracker instanceof EntityPlayer) {
      return new PacketPlayOutNamedEntitySpawn((EntityHuman) this.tracker);
    } else if (this.tracker instanceof IAnimal) {
      this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
      return new PacketPlayOutSpawnEntityLiving((EntityLiving) this.tracker);
    } else if (this.tracker instanceof EntityPainting) {
      return new PacketPlayOutSpawnEntityPainting((EntityPainting) this.tracker);
    } else if (this.tracker instanceof EntityItem) {
      return new PacketPlayOutSpawnEntity(this.tracker, 2, 1);
    } else if (this.tracker instanceof EntityMinecartAbstract) {
      EntityMinecartAbstract entityminecartabstract = (EntityMinecartAbstract) this.tracker;

      return new PacketPlayOutSpawnEntity(this.tracker, 10, entityminecartabstract.v().a());
    } else if (this.tracker instanceof EntityBoat) {
      return new PacketPlayOutSpawnEntity(this.tracker, 1);
    } else if (this.tracker instanceof EntityExperienceOrb) {
      return new PacketPlayOutSpawnEntityExperienceOrb((EntityExperienceOrb) this.tracker);
    } else if (this.tracker instanceof EntityFishingHook) {
      EntityHuman entityhuman = ((EntityFishingHook) this.tracker).l();

      return new PacketPlayOutSpawnEntity(
          this.tracker, 90, entityhuman == null ? this.tracker.getId() : entityhuman.getId());
    } else {
      Entity entity;

      if (this.tracker instanceof EntitySpectralArrow) {
        entity = ((EntitySpectralArrow) this.tracker).shooter;
        return new PacketPlayOutSpawnEntity(
            this.tracker, 91, 1 + (entity == null ? this.tracker.getId() : entity.getId()));
      } else if (this.tracker instanceof EntityTippedArrow) {
        entity = ((EntityArrow) this.tracker).shooter;
        return new PacketPlayOutSpawnEntity(
            this.tracker, 60, 1 + (entity == null ? this.tracker.getId() : entity.getId()));
      } else if (this.tracker instanceof EntitySnowball) {
        return new PacketPlayOutSpawnEntity(this.tracker, 61);
      } else if (this.tracker instanceof EntityLlamaSpit) {
        return new PacketPlayOutSpawnEntity(this.tracker, 68);
      } else if (this.tracker instanceof EntityPotion) {
        return new PacketPlayOutSpawnEntity(this.tracker, 73);
      } else if (this.tracker instanceof EntityThrownExpBottle) {
        return new PacketPlayOutSpawnEntity(this.tracker, 75);
      } else if (this.tracker instanceof EntityEnderPearl) {
        return new PacketPlayOutSpawnEntity(this.tracker, 65);
      } else if (this.tracker instanceof EntityEnderSignal) {
        return new PacketPlayOutSpawnEntity(this.tracker, 72);
      } else if (this.tracker instanceof EntityFireworks) {
        return new PacketPlayOutSpawnEntity(this.tracker, 76);
      } else if (this.tracker instanceof EntityFireball) {
        EntityFireball entityfireball = (EntityFireball) this.tracker;
        PacketPlayOutSpawnEntity packetplayoutspawnentity = null;
        byte b0 = 63;

        if (this.tracker instanceof EntitySmallFireball) {
          b0 = 64;
        } else if (this.tracker instanceof EntityDragonFireball) {
          b0 = 93;
        } else if (this.tracker instanceof EntityWitherSkull) {
          b0 = 66;
        }

        if (entityfireball.shooter != null) {
          packetplayoutspawnentity =
              new PacketPlayOutSpawnEntity(
                  this.tracker, b0, ((EntityFireball) this.tracker).shooter.getId());
        } else {
          packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, b0, 0);
        }

        packetplayoutspawnentity.a((int) (entityfireball.dirX * 8000.0D));
        packetplayoutspawnentity.b((int) (entityfireball.dirY * 8000.0D));
        packetplayoutspawnentity.c((int) (entityfireball.dirZ * 8000.0D));
        return packetplayoutspawnentity;
      } else if (this.tracker instanceof EntityShulkerBullet) {
        PacketPlayOutSpawnEntity packetplayoutspawnentity1 =
            new PacketPlayOutSpawnEntity(this.tracker, 67, 0);

        packetplayoutspawnentity1.a((int) (this.tracker.motX * 8000.0D));
        packetplayoutspawnentity1.b((int) (this.tracker.motY * 8000.0D));
        packetplayoutspawnentity1.c((int) (this.tracker.motZ * 8000.0D));
        return packetplayoutspawnentity1;
      } else if (this.tracker instanceof EntityEgg) {
        return new PacketPlayOutSpawnEntity(this.tracker, 62);
      } else if (this.tracker instanceof EntityEvokerFangs) {
        return new PacketPlayOutSpawnEntity(this.tracker, 79);
      } else if (this.tracker instanceof EntityTNTPrimed) {
        return new PacketPlayOutSpawnEntity(this.tracker, 50);
      } else if (this.tracker instanceof EntityEnderCrystal) {
        return new PacketPlayOutSpawnEntity(this.tracker, 51);
      } else if (this.tracker instanceof EntityFallingBlock) {
        EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;

        return new PacketPlayOutSpawnEntity(
            this.tracker, 70, Block.getCombinedId(entityfallingblock.getBlock()));
      } else if (this.tracker instanceof EntityArmorStand) {
        return new PacketPlayOutSpawnEntity(this.tracker, 78);
      } else if (this.tracker instanceof EntityItemFrame) {
        EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;

        return new PacketPlayOutSpawnEntity(
            this.tracker,
            71,
            entityitemframe.direction.get2DRotationValue(),
            entityitemframe.getBlockPosition());
      } else if (this.tracker instanceof EntityLeash) {
        EntityLeash entityleash = (EntityLeash) this.tracker;

        return new PacketPlayOutSpawnEntity(this.tracker, 77, 0, entityleash.getBlockPosition());
      } else if (this.tracker instanceof EntityAreaEffectCloud) {
        return new PacketPlayOutSpawnEntity(this.tracker, 3);
      } else {
        throw new IllegalArgumentException(
            "Don\'t know how to add " + this.tracker.getClass() + "!");
      }
    }
  }