From 3e2d1847ed38d05ae3c83dcd590416f66007608e Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 3 May 2020 18:36:29 +0200 Subject: [PATCH] Little performance improvement --- CHANGELOG.md | 1 + .../slimefun4/utils/itemstack/ItemStackWrapper.java | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 594d0d5f9..fc55b2c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ## Release Candidate 12 (TBD) #### Changes +* Little performance improvements * Bandages, Rags and Splints will no longer be consumed if your health is full and you are not on fire #### Fixes diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java index 4ac3a73ac..3365abd56 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ItemStackWrapper.java @@ -21,7 +21,8 @@ public final class ItemStackWrapper extends ItemStack { private ItemMeta meta; public ItemStackWrapper(ItemStack item) { - super(item); + super(item.getType(), item.getAmount()); + meta = item.getItemMeta(); } @Override @@ -30,10 +31,6 @@ public final class ItemStackWrapper extends ItemStack { // Since this class is immutable, we can simply let the super class create one copy // and then store that instead of creating a clone everytime. // This will significantly speed up any loop comparisons if used correctly. - if (meta == null) { - meta = super.getItemMeta(); - } - return meta; }