Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Don't cache Item
Dieser Commit ist enthalten in:
Ursprung
c7c5c79365
Commit
d76e70b1f7
@ -35,7 +35,7 @@ public class HandItemCache extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Item convert(ItemStack itemInHand) {
|
public static Item convert(ItemStack itemInHand) {
|
||||||
if (itemInHand == null) return Item.EMPTY;
|
if (itemInHand == null) new Item((short) 0, (byte) 0, (short) 0, null);
|
||||||
return new Item((short) itemInHand.getTypeId(), (byte) itemInHand.getAmount(), itemInHand.getDurability(), null);
|
return new Item((short) itemInHand.getTypeId(), (byte) itemInHand.getAmount(), itemInHand.getDurability(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import lombok.*;
|
|||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class Item {
|
public class Item {
|
||||||
public static final Item EMPTY = new Item((short) 0, (byte) 0, (short) 0, null);
|
|
||||||
@SerializedName(value = "identifier", alternate = "id")
|
@SerializedName(value = "identifier", alternate = "id")
|
||||||
private int identifier;
|
private int identifier;
|
||||||
private byte amount;
|
private byte amount;
|
||||||
|
@ -51,7 +51,7 @@ public class HandItemCache implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Item convert(ItemStack itemInHand) {
|
public static Item convert(ItemStack itemInHand) {
|
||||||
if (itemInHand == null) return Item.EMPTY;
|
if (itemInHand == null) return new Item((short) 0, (byte) 0, (short) 0, null);
|
||||||
if (GET_DAMAGE == null) {
|
if (GET_DAMAGE == null) {
|
||||||
try {
|
try {
|
||||||
GET_DAMAGE = itemInHand.getClass().getDeclaredField("field_77991_e");
|
GET_DAMAGE = itemInHand.getClass().getDeclaredField("field_77991_e");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren