Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
00be0b7b30
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: d25437bc Update to Minecraft 1.18-pre8 CraftBukkit Changes: 5a39a236 Update to Minecraft 1.18-pre8 Spigot Changes: 7840c2af Update to Minecraft 1.18-pre8
21 Zeilen
974 B
Diff
21 Zeilen
974 B
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 21 Dec 2016 03:48:29 -0500
|
|
Subject: [PATCH] Optimize ItemStack.isEmpty()
|
|
|
|
Remove hashMap lookup every check, simplify code to remove ternary
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index c39d3f15ebc8956714f963ce7ed11e0f2b2bad4f..033f7486556f5928d902dd25cd3d5a38e0e8097e 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -241,7 +241,7 @@ public final class ItemStack {
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
- return this == ItemStack.EMPTY ? true : (this.getItem() != null && !this.is(Items.AIR) ? this.count <= 0 : true);
|
|
+ return this == ItemStack.EMPTY || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper
|
|
}
|
|
|
|
public ItemStack split(int amount) {
|