Attach absent tile entity and entity lists to the chunk tag

This commit is contained in:
Ruling-0 committed 2026-08-27 22:44:03 -05:00
1 parent 71d49fc7d9
commit dbcfcbff48
3 files changed
+61 -6

No files matched your search

@@ -0,0 +1,35 @@
package com.gtnewhorizons.postea.utility;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import org.junit.jupiter.api.Test;
class NbtListsTest {
@Test
void anAbsentListIsCreatedAndAttachedSoAppendedTagsAreKept() {
NBTTagCompound level = new NBTTagCompound();
NbtLists.compoundList(level, "TileEntities")
.appendTag(new NBTTagCompound());
assertEquals(
1,
level.getTagList("TileEntities", 10)
.tagCount());
}
@Test
void anExistingListIsReturnedAsIs() {
NBTTagCompound level = new NBTTagCompound();
NBTTagList existing = new NBTTagList();
existing.appendTag(new NBTTagCompound());
level.setTag("Entities", existing);
assertSame(existing, NbtLists.compoundList(level, "Entities"));
}
}