mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-26 01:51:26 +01:00
Test item snbt in tag
This commit is contained in:
parent
60d22929a1
commit
3c2ef39d1b
@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
import static net.minestom.server.api.TestUtils.assertEqualsSNBT;
|
||||||
import static net.minestom.server.api.TestUtils.waitUntilCleared;
|
import static net.minestom.server.api.TestUtils.waitUntilCleared;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
@ -91,4 +92,22 @@ public class TagItemTest {
|
|||||||
assertEquals(item2.toItemNBT(), handler.getTag(nbtTag));
|
assertEquals(item2.toItemNBT(), handler.getTag(nbtTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void snbt() {
|
||||||
|
var handler = TagHandler.newHandler();
|
||||||
|
var tag = Tag.ItemStack("item");
|
||||||
|
handler.setTag(tag, ItemStack.of(Material.DIAMOND));
|
||||||
|
assertEqualsSNBT("""
|
||||||
|
{
|
||||||
|
"item": {
|
||||||
|
"id":"minecraft:diamond",
|
||||||
|
"Count":1B,
|
||||||
|
"tag":{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""", handler.asCompound());
|
||||||
|
handler.removeTag(tag);
|
||||||
|
assertEqualsSNBT("{}", handler.asCompound());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user