Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions blockcrafter/mcmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ def get_blockstate(self, identifier):
prefix, name = identifier.split(":")
path = self.blockstate_base.format(prefix=prefix) + "/" + name + ".json"
properties = self._blockstate_properties.get(identifier)
return Blockstate(self, prefix, name, json.loads(self.source.load_file(path)), properties=properties)
### EDIT (Pull request from Berghopper)
json_loads_obj = self.source.load_file(path)
if isinstance(json_loads_obj, bytes):
json_loads_obj = json_loads_obj.decode("utf-8")
return Blockstate(self, prefix, name, json.loads(json_loads_obj), properties=properties)

@property
def blockstate_files(self):
Expand All @@ -367,7 +371,11 @@ def _get_model_json(self, path):
if path in self._model_json_cache:
return self._model_json_cache[path]

m = json.loads(self.source.load_file(path))
### EDIT (Pull request from Berghopper)
json_loads_obj = self.source.load_file(path)
if isinstance(json_loads_obj, bytes):
json_loads_obj = json_loads_obj.decode("utf-8")
m = json.loads(json_loads_obj)

textures = {}
elements = {}
Expand Down