Little more progress
Keep getting interrupted so not as much as I'd like :(
This commit is contained in:
@@ -11,7 +11,7 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set.
|
||||
Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index d273f24da..b1ea5b93d 100644
|
||||
index 553f60987..ba8fbef85 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
|
||||
@@ -24,36 +24,28 @@ index d273f24da..b1ea5b93d 100644
|
||||
|
||||
static boolean hasItemMeta(net.minecraft.server.ItemStack item) {
|
||||
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||
index 919f2ffa9..4726386ef 100644
|
||||
index 3a82bede7..d73141839 100644
|
||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||
@@ -0,0 +0,0 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
+import java.util.Collections; // Paper
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper
|
||||
@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase {
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
assertThat("noTag and enchanted stacks should not be similar", noTag.isSimilar(enchanted), is(false));
|
||||
assertThat("noTag and enchanted stacks should not be equal", noTag.equals(enchanted), is(false));
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
-import java.util.ArrayList;
|
||||
-import java.util.Arrays;
|
||||
-import java.util.List;
|
||||
-import java.util.UUID;
|
||||
+
|
||||
+ // Paper start - test additional ItemMeta damage cases
|
||||
+ ItemStack clone = CraftItemStack.asBukkitCopy(CraftItemStack.asNMSCopy(noDamage));
|
||||
+ assertThat("Bukkit and craft stacks should be similar", noDamage.isSimilar(clone), is(true));
|
||||
+ assertThat("Bukkit and craft stacks should be equal", noDamage.equals(clone), is(true));
|
||||
+
|
||||
+ ItemStack pureBukkit = new ItemStack(Material.DIAMOND_SWORD);
|
||||
+ pureBukkit.setDurability((short) 2);
|
||||
+ net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(pureBukkit);
|
||||
+ ItemStack other = CraftItemStack.asBukkitCopy(nms);
|
||||
+
|
||||
+ assertThat("Bukkit and NMS ItemStack copies should be similar", pureBukkit.isSimilar(other), is(true));
|
||||
+ assertThat("Bukkit and NMS ItemStack copies should be equal", pureBukkit.equals(other), is(true));
|
||||
+ }
|
||||
+import java.util.*;
|
||||
+
|
||||
import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.IRegistry;
|
||||
@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase {
|
||||
assertThat(itemMeta.hasConflictingEnchant(null), is(false));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void testItemMeta(ItemStack stack) {
|
||||
+ assertThat("Should not have ItemMeta", stack.hasItemMeta(), is(false));
|
||||
+
|
||||
@@ -78,9 +70,10 @@ index 919f2ffa9..4726386ef 100644
|
||||
+
|
||||
+ testItemMeta(itemStack);
|
||||
+ testItemMeta(CraftItemStack.asCraftCopy(itemStack));
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
@Test
|
||||
public void testBlockStateMeta() {
|
||||
public void testConflictingStoredEnchantment() {
|
||||
EnchantmentStorageMeta itemMeta = (EnchantmentStorageMeta) Bukkit.getItemFactory().getItemMeta(Material.ENCHANTED_BOOK);
|
||||
--
|
||||
Reference in New Issue
Block a user