feat: respectfully add NPC deserializing
This commit is contained in:
parent
0fce509111
commit
27adfd1b6f
@ -55,6 +55,16 @@ public class EntityDeserializer extends JsonDeserializer<Entity> {
|
|||||||
((Character) result).inventory.addStone(StoneType.valueOf(i));
|
((Character) result).inventory.addStone(StoneType.valueOf(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case NPC -> {
|
||||||
|
result = new NPC(
|
||||||
|
new EntityID(EntityType.NPC, node.get("ID").asInt()),
|
||||||
|
codec.treeToValue(node.get("position"), IntVector2.class),
|
||||||
|
node.get("MP").asInt()
|
||||||
|
);
|
||||||
|
for (var i: codec.treeToValue(node.get("stones"), Integer[].class)) {
|
||||||
|
((NPC) result).inventory.addStone(StoneType.valueOf(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
case InfinityStone -> result = new InfinityStone(
|
case InfinityStone -> result = new InfinityStone(
|
||||||
new EntityID(EntityType.InfinityStones, node.get("ID").asInt()),
|
new EntityID(EntityType.InfinityStones, node.get("ID").asInt()),
|
||||||
codec.treeToValue(node.get("position"), IntVector2.class),
|
codec.treeToValue(node.get("position"), IntVector2.class),
|
||||||
|
Loading…
Reference in New Issue
Block a user