Ejemplo n.º 1
0
  /**
   * Will update the entity in the world if the chunk the entity is in is currently loaded or its
   * forced to update. Args: entity, forceUpdate
   */
  public void updateEntityWithOptionalForce(Entity par1Entity, boolean par2) {
    if (!this.mcServer.getCanSpawnAnimals()
        && (par1Entity instanceof EntityAnimal || par1Entity instanceof EntityWaterMob)) {
      par1Entity.setDead();
    }

    if (!this.mcServer.getCanSpawnNPCs() && par1Entity instanceof INpc) {
      par1Entity.setDead();
    }

    super.updateEntityWithOptionalForce(par1Entity, par2);
  }
Ejemplo n.º 2
0
  /** Will get destroyed next tick. */
  public void setDead() {
    if (this.field_82345_h) {
      for (int var1 = 0; var1 < this.getSizeInventory(); ++var1) {
        ItemStack var2 = this.getStackInSlot(var1);

        if (var2 != null) {
          float var3 = this.rand.nextFloat() * 0.8F + 0.1F;
          float var4 = this.rand.nextFloat() * 0.8F + 0.1F;
          float var5 = this.rand.nextFloat() * 0.8F + 0.1F;

          while (var2.stackSize > 0) {
            int var6 = this.rand.nextInt(21) + 10;

            if (var6 > var2.stackSize) {
              var6 = var2.stackSize;
            }

            var2.stackSize -= var6;
            EntityItem var7 =
                new EntityItem(
                    this.worldObj,
                    this.posX + (double) var3,
                    this.posY + (double) var4,
                    this.posZ + (double) var5,
                    new ItemStack(var2.itemID, var6, var2.getItemDamage()));

            if (var2.hasTagCompound()) {
              var7.func_92059_d().setTagCompound((NBTTagCompound) var2.getTagCompound().copy());
            }

            float var8 = 0.05F;
            var7.motionX = (double) ((float) this.rand.nextGaussian() * var8);
            var7.motionY = (double) ((float) this.rand.nextGaussian() * var8 + 0.2F);
            var7.motionZ = (double) ((float) this.rand.nextGaussian() * var8);
            this.worldObj.spawnEntityInWorld(var7);
          }
        }
      }
    }

    super.setDead();

    if (this.field_82344_g != null) {
      this.field_82344_g.update();
    }
  }
Ejemplo n.º 3
0
 @Override
 public void setDead() {
   shooter = null;
   super.setDead();
 }
Ejemplo n.º 4
0
 /** sets the dead flag. Used when you fall off the bottom of the world. */
 protected void kill() {
   setDead();
 }
Ejemplo n.º 5
0
 /* ENTITY HANDLING */
 public void removeEntity(Entity entity) {
   entity.setDead();
 }