floating blocks drop as item past height limit.

This commit is contained in:
bconlon 2020-12-28 17:15:16 -08:00
parent 531a65e9e3
commit 8b2f0affe4
1 changed files with 16 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -84,6 +86,11 @@ public class EntityFloatingBlock extends Entity implements IEntityAdditionalSpaw
if (this.ticksExisted > 200)
{
if (!this.worldObj.isRemote)
{
this.entityDropItem(new ItemStack(Item.getItemFromBlock(this.getBlock())),0.0F);
}
this.setDead();
}
else
@ -101,6 +108,15 @@ public class EntityFloatingBlock extends Entity implements IEntityAdditionalSpaw
this.posY = j;
this.posZ = k + 0.5D;
}
if (this.posY > this.worldObj.getHeight())
{
if (!this.worldObj.isRemote)
{
this.setDead();
this.entityDropItem(new ItemStack(Item.getItemFromBlock(this.getBlock())),0.0F);
}
}
}
}