summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-11-25 10:31:53 +1100
committermd_5 <git@md-5.net>2016-11-25 10:31:53 +1100
commit78c7614349845f26cdb39514b7015e1c220dab37 (patch)
treed682ceeb685e7e7f9652ccf6f1997b67a0767cdf /nms-patches
parentc3d951ddcd943218425b690166e936db1e53ea15 (diff)
downloadcraftbukkit-78c7614349845f26cdb39514b7015e1c220dab37.tar
craftbukkit-78c7614349845f26cdb39514b7015e1c220dab37.tar.gz
craftbukkit-78c7614349845f26cdb39514b7015e1c220dab37.tar.lz
craftbukkit-78c7614349845f26cdb39514b7015e1c220dab37.tar.xz
craftbukkit-78c7614349845f26cdb39514b7015e1c220dab37.zip
SPIGOT-2842: Improve item age handling
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/EntityItem.patch39
1 files changed, 7 insertions, 32 deletions
diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch
index 3b425b41..4215e019 100644
--- a/nms-patches/EntityItem.patch
+++ b/nms-patches/EntityItem.patch
@@ -12,23 +12,11 @@
private String g;
private String h;
public float a;
-+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit
++ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
public EntityItem(World world, double d0, double d1, double d2) {
super(world);
-@@ -30,6 +32,11 @@
-
- public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
- this(world, d0, d1, d2);
-+ // CraftBukkit start - Can't set null items in the datawatcher
-+ if (itemstack == null || itemstack.getItem() == null) {
-+ return;
-+ }
-+ // CraftBukkit end
- this.setItemStack(itemstack);
- }
-
-@@ -54,9 +61,12 @@
+@@ -54,9 +56,12 @@
this.die();
} else {
super.A_();
@@ -44,7 +32,7 @@
this.lastX = this.locX;
this.lastY = this.locY;
-@@ -104,9 +114,11 @@
+@@ -104,9 +109,11 @@
this.motY *= -0.5D;
}
@@ -56,7 +44,7 @@
this.ak();
if (!this.world.isClientSide) {
-@@ -121,6 +133,12 @@
+@@ -121,6 +128,12 @@
}
if (!this.world.isClientSide && this.age >= 6000) {
@@ -69,7 +57,7 @@
this.die();
}
-@@ -162,6 +180,7 @@
+@@ -162,6 +175,7 @@
} else if (itemstack1.getCount() + itemstack.getCount() > itemstack1.getMaxStackSize()) {
return false;
} else {
@@ -77,7 +65,7 @@
itemstack1.add(itemstack.getCount());
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
entityitem.age = Math.min(entityitem.age, this.age);
-@@ -208,6 +227,11 @@
+@@ -208,6 +222,11 @@
} else if (!this.getItemStack().isEmpty() && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) {
return false;
} else {
@@ -89,20 +77,7 @@
this.ap();
this.f = (int) ((float) this.f - f);
if (this.f <= 0) {
-@@ -257,6 +281,12 @@
-
- NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
-
-+ // CraftBukkit start - Handle missing "Item" compounds
-+ if (nbttagcompound1 == null) {
-+ this.die();
-+ return;
-+ }
-+ // CraftBukkit end
- this.setItemStack(new ItemStack(nbttagcompound1));
- if (this.getItemStack().isEmpty()) {
- this.die();
-@@ -270,6 +300,26 @@
+@@ -270,6 +289,26 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();