Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

Commit

Permalink
Fixed #146 Error on trying to create a new project from an existing r…
Browse files Browse the repository at this point in the history
…esourcepack
  • Loading branch information
MarcusElg committed Mar 16, 2018
1 parent 40e43f7 commit 66f7e96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/net/mightypork/rpw/struct/PackMcmeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public static Type getType() {
public static PackMcmeta fromJson(String json) {
PackMcmeta packMcmeta = new PackMcmeta();
packMcmeta.languages = new LangEntryMap();
int packFormat = Integer.parseInt(json.substring(json.indexOf("pack_format\": ") + 14, json.indexOf(",", json.indexOf("pack_format\": ") + 14)));
String description = json.substring(json.indexOf("description\": ") + 14, json.indexOf("},", json.indexOf("description\": ") + 14));
//{"pack":{"pack_format":3,"description":"§e§u§lPack Desc"}}
String jsonNoSpace = json.replaceAll("\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)", "");
int packFormat = Integer.parseInt(jsonNoSpace.substring(23, 24));
String description = jsonNoSpace.substring(40, jsonNoSpace.indexOf("\"", 40));
packMcmeta.setPackInfo(new PackInfo(packFormat, description));

int languages = 0;
Expand Down

0 comments on commit 66f7e96

Please sign in to comment.