Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-2842: Improve item age handling
Dieser Commit ist enthalten in:
Ursprung
c3d951ddcd
Commit
78c7614349
@ -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();
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren