Skip to content

Commit

Permalink
Use GsonHelper in page type deserialization
Browse files Browse the repository at this point in the history
For the better error message
  • Loading branch information
williewillus committed Sep 21, 2023
1 parent 43af6a9 commit 459f98a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.GsonHelper;

import vazkii.patchouli.api.PatchouliAPI;
import vazkii.patchouli.client.book.page.*;
Expand Down Expand Up @@ -105,8 +106,7 @@ public BookPage deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
}

JsonObject obj = json.getAsJsonObject();
JsonPrimitive prim = (JsonPrimitive) obj.get("type");
String string = prim.getAsString();
String string = GsonHelper.getAsString(obj, "type");
if (string.indexOf(':') < 0) {
string = PatchouliAPI.MOD_ID + ":" + string;
}
Expand Down

0 comments on commit 459f98a

Please sign in to comment.