Fix bug with saving mobs in blueprints #2497

This commit is contained in:
tastybento 2024-09-07 11:06:35 -07:00
parent 86c9a8f47b
commit dbf4bb75b1
2 changed files with 11 additions and 3 deletions

View File

@ -12,8 +12,12 @@ import com.google.gson.stream.JsonWriter;
public class ProfessionTypeAdapter extends TypeAdapter<Profession> {
@Override
public void write(JsonWriter out, Profession profession) throws IOException {
out.value(profession.name());
public void write(JsonWriter out, Profession profession) throws IOException {
if (profession != null) {
out.value(profession.name());
return;
}
out.nullValue();
}
@Override

View File

@ -12,7 +12,11 @@ import com.google.gson.stream.JsonWriter;
public class VillagerTypeAdapter extends TypeAdapter<Villager.Type> {
@Override
public void write(JsonWriter out, Villager.Type type) throws IOException {
public void write(JsonWriter out, Villager.Type type) throws IOException {
if (type == null) {
out.nullValue();
return;
}
out.value(type.name());
}