Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected boolean isCorpse;
- @Override
- public void onEntityUpdate() {
- if (this.isCorpse)
- this.corpseTimer();
- else
- super.onEntityUpdate();
- }
- @Override
- protected int getDropItemId() {
- this.corpseTimer();
- return super.getDropItemId();
- }
- protected void corpseTimer() {
- if (!this.isCorpse && this.health <= 0)
- this.isCorpse = true;
- if (this.isCorpse) {
- // This keeps the corpse on the ground after it dies.
- if (this.deathTime >= 18)
- this.deathTime = 18;
- }
- }
- @Override
- public void readEntityFromNBT(NBTTagCompound nbt) {
- super.readEntityFromNBT(nbt);
- this.isCorpse = nbt.getBoolean("Corpse");
- }
- @Override
- public void writeEntityToNBT(NBTTagCompound nbt) {
- super.writeEntityToNBT(nbt);
- nbt.setBoolean("Corpse", this.isCorpse);
- }
Advertisement