3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Don't cache Item

Dieser Commit ist enthalten in:
KennyTV 2019-04-27 18:59:18 +02:00
Ursprung c7c5c79365
Commit d76e70b1f7
3 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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);
} }
} }

Datei anzeigen

@ -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;

Datei anzeigen

@ -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");