Support for weather in rules / Sector weather

This commit is contained in:
Anuken
2020-05-08 21:51:17 -04:00
parent d7eb365446
commit 95a1d84eb9
30 changed files with 141 additions and 29 deletions

View File

@@ -68,6 +68,8 @@ public class JsonIO{
json.setElementType(Rules.class, "spawns", SpawnGroup.class);
json.setElementType(Rules.class, "loadout", ItemStack.class);
//TODO this is terrible
json.setSerializer(Sector.class, new Serializer<Sector>(){
@Override
public void write(Json json, Sector object, Class knownType){
@@ -131,6 +133,18 @@ public class JsonIO{
}
});
json.setSerializer(Weather.class, new Serializer<Weather>(){
@Override
public void write(Json json, Weather object, Class knownType){
json.writeValue(object.name);
}
@Override
public Weather read(Json json, JsonValue jsonData, Class type){
return Vars.content.getByName(ContentType.weather, jsonData.asString());
}
});
json.setSerializer(ItemStack.class, new Serializer<ItemStack>(){
@Override
public void write(Json json, ItemStack object, Class knownType){

View File

@@ -241,7 +241,7 @@ public abstract class SaveVersion extends SaveFileReader{
Array<TeamData> data = state.teams.getActive();
stream.writeInt(data.size);
for(TeamData team : data){
stream.writeInt((int)team.team.id);
stream.writeInt(team.team.id);
stream.writeInt(team.brokenBlocks.size);
for(BrokenBlock block : team.brokenBlocks){
stream.writeShort(block.x);