/// Called when this entity is killed. @Override protected void dropFewItems(boolean hit, int looting) { super.dropFewItems(hit, looting); for (int i = this.rand.nextInt(2) + 1; i-- > 0; ) { this.dropItem(Items.string, 1); } }
/// Called when this entity is killed. @Override protected void dropFewItems(boolean hit, int looting) { super.dropFewItems(hit, looting); if (hit && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + looting) > 0)) { this.entityDropItem( new ItemStack( Items.spawn_egg, 1, EntityList.getEntityID(new EntitySpider(this.worldObj))), 0.0F); } if (!this.worldObj.isRemote) { EntityBabySpider baby = null; for (int i = this.babies; i-- > 0; ) { baby = new EntityBabySpider(this.worldObj); baby.copyLocationAndAnglesFrom(this); baby.setTarget(this.getEntityToAttack()); baby.onSpawnWithEgg((IEntityLivingData) null); this.worldObj.spawnEntityInWorld(baby); } if (baby != null) { this.worldObj.playSoundAtEntity( baby, "random.pop", 1.0F, 2.0F / (this.rand.nextFloat() * 0.4F + 0.8F)); baby.spawnExplosionParticle(); } } }
/// Reads this entity from NBT. @Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); NBTTagCompound saveTag = SpecialMobData.getSaveLocation(tag); if (saveTag.hasKey("Babies")) { this.babies = saveTag.getByte("Babies"); } else if (tag.hasKey("Babies")) { this.babies = tag.getByte("Babies"); } }
/// Saves this entity to NBT. @Override public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); NBTTagCompound saveTag = SpecialMobData.getSaveLocation(tag); saveTag.setByte("Babies", this.babies); }