mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-25 22:44:51 +00:00
Attach absent tile entity and entity lists to the chunk tag
This commit is contained in:
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"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user