Force remove an EntityItem entity if it contains an unknown item id
This commit is contained in:
parent
3b140b91c9
commit
a985c7ec2a
1 changed files with 15 additions and 0 deletions
|
|
@ -23,6 +23,15 @@ public class EntityItem extends Entity {
|
||||||
this.yOffset = this.height / 2.0F;
|
this.yOffset = this.height / 2.0F;
|
||||||
this.setPosition(var2, var4, var6);
|
this.setPosition(var2, var4, var6);
|
||||||
this.item = var8;
|
this.item = var8;
|
||||||
|
// Patch start
|
||||||
|
if (this.item.itemID < 0 || this.item.itemID >= Item.itemsList.length || Item.itemsList[this.item.itemID] == null) {
|
||||||
|
this.setEntityDead();
|
||||||
|
this.item = new ItemStack(Block.stone); // Workaround for the EntityTracker
|
||||||
|
}
|
||||||
|
if (this.item.stackSize < 1) {
|
||||||
|
this.item.stackSize = 1;
|
||||||
|
}
|
||||||
|
// Patch end
|
||||||
this.rotationYaw = (float) (Math.random() * 360.0D);
|
this.rotationYaw = (float) (Math.random() * 360.0D);
|
||||||
this.motionX = (double) ((float) (Math.random() * (double) 0.2F - (double) 0.1F));
|
this.motionX = (double) ((float) (Math.random() * (double) 0.2F - (double) 0.1F));
|
||||||
this.motionY = (double) 0.2F;
|
this.motionY = (double) 0.2F;
|
||||||
|
|
@ -47,6 +56,12 @@ public class EntityItem extends Entity {
|
||||||
if (this.delayBeforeCanPickup > 0) {
|
if (this.delayBeforeCanPickup > 0) {
|
||||||
--this.delayBeforeCanPickup;
|
--this.delayBeforeCanPickup;
|
||||||
}
|
}
|
||||||
|
// Patch start
|
||||||
|
if (this.item.itemID < 0 || this.item.itemID >= Item.itemsList.length || Item.itemsList[this.item.itemID] == null) {
|
||||||
|
this.setEntityDead();
|
||||||
|
this.age = 6001;
|
||||||
|
}
|
||||||
|
// Patch end
|
||||||
|
|
||||||
this.prevPosX = this.posX;
|
this.prevPosX = this.posX;
|
||||||
this.prevPosY = this.posY;
|
this.prevPosY = this.posY;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue