mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-13 07:09:51 +01:00
Use the builder methods instead of fields
This commit is contained in:
parent
d6e7c9a635
commit
64e70c3b64
@ -85,18 +85,17 @@ public class CompassMeta extends ItemMeta implements ItemMetaBuilder.Provider<Co
|
||||
@Override
|
||||
public void read(@NotNull NBTCompound nbtCompound) {
|
||||
if (nbtCompound.containsKey("LodestoneTracked")) {
|
||||
this.lodestoneTracked = nbtCompound.getByte("LodestoneTracked") == 1;
|
||||
lodestoneTracked(nbtCompound.getByte("LodestoneTracked") == 1);
|
||||
}
|
||||
if (nbtCompound.containsKey("LodestoneDimension")) {
|
||||
this.lodestoneDimension = nbtCompound.getString("LodestoneDimension");
|
||||
lodestoneDimension(nbtCompound.getString("LodestoneDimension"));
|
||||
}
|
||||
if (nbtCompound.containsKey("LodestonePos")) {
|
||||
final NBTCompound posCompound = nbtCompound.getCompound("LodestonePos");
|
||||
final int x = posCompound.getInt("X");
|
||||
final int y = posCompound.getInt("Y");
|
||||
final int z = posCompound.getInt("Z");
|
||||
|
||||
this.lodestonePosition = new Position(x, y, z);
|
||||
lodestonePosition(new Position(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTList;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Supplier;
|
||||
@ -151,6 +152,7 @@ public class MapMeta extends ItemMeta {
|
||||
|
||||
if (compound.containsKey("Decorations")) {
|
||||
final NBTList<NBTCompound> decorationsList = compound.getList("Decorations");
|
||||
List<MapDecoration> mapDecorations = new ArrayList<>();
|
||||
for (NBTCompound decorationCompound : decorationsList) {
|
||||
final String id = decorationCompound.getString("id");
|
||||
final byte type = decorationCompound.getAsByte("type");
|
||||
@ -170,14 +172,15 @@ public class MapMeta extends ItemMeta {
|
||||
rotation = decorationCompound.getAsDouble("rot");
|
||||
}
|
||||
|
||||
this.decorations.add(new MapDecoration(id, type, x, z, rotation));
|
||||
mapDecorations.add(new MapDecoration(id, type, x, z, rotation));
|
||||
}
|
||||
decorations(mapDecorations);
|
||||
}
|
||||
|
||||
if (compound.containsKey("display")) {
|
||||
final NBTCompound displayCompound = compound.getCompound("display");
|
||||
if (displayCompound.containsKey("MapColor")) {
|
||||
this.mapColor = new Color(displayCompound.getAsInt("MapColor"));
|
||||
mapColor(new Color(displayCompound.getAsInt("MapColor")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user