Use map for compass meta

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-17 21:13:18 +01:00
parent 8dcc3000cf
commit 34785e96f3

View File

@ -9,6 +9,7 @@ import org.jetbrains.annotations.Nullable;
import org.jglrxavpok.hephaistos.nbt.NBT; import org.jglrxavpok.hephaistos.nbt.NBT;
import org.jglrxavpok.hephaistos.nbt.NBTCompound; import org.jglrxavpok.hephaistos.nbt.NBTCompound;
import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
public class CompassMeta extends ItemMeta implements ItemMetaBuilder.Provider<CompassMeta.Builder> { public class CompassMeta extends ItemMeta implements ItemMetaBuilder.Provider<CompassMeta.Builder> {
@ -70,11 +71,10 @@ public class CompassMeta extends ItemMeta implements ItemMetaBuilder.Provider<Co
mutateNbt(compound -> { mutateNbt(compound -> {
if (lodestonePosition != null) { if (lodestonePosition != null) {
compound.set("LodestonePos", NBT.Compound(posCompound -> { compound.set("LodestonePos", NBT.Compound(Map.of(
posCompound.setInt("X", lodestonePosition.blockX()); "X", NBT.Int(lodestonePosition.blockX()),
posCompound.setInt("Y", lodestonePosition.blockY()); "Y", NBT.Int(lodestonePosition.blockY()),
posCompound.setInt("Z", lodestonePosition.blockZ()); "Z", NBT.Int(lodestonePosition.blockZ()))));
}));
} else { } else {
compound.remove("LodestonePos"); compound.remove("LodestonePos");
} }