Skip to content

Commit

Permalink
Add separate 1.8 handler for saving TileEntities to NBT
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHeijden committed Jan 22, 2021
1 parent c4dba56 commit 49dacc2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.frankheijden.minecraftreflection.ClassObject;
import dev.frankheijden.minecraftreflection.MinecraftReflection;
import io.papermc.lib.PaperLib;
import java.util.Map;
import java.util.Set;
import net.frankheijden.insights.managers.NMSManager;
Expand Down Expand Up @@ -57,7 +58,11 @@ public static Object getNBT(Block block) {
if (tile == null) return null;

Object tag = nbtTagCompoundReflection.newInstance();
tileEntityReflection.invoke(tile, "save", tag);
if (PaperLib.isVersion(8)) {
tileEntityReflection.invoke(tile, "b", tag);
} else {
tileEntityReflection.invoke(tile, "save", tag);
}

return tag;
}
Expand Down

0 comments on commit 49dacc2

Please sign in to comment.