@Override
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
String modelPath = modelLocation.getResourcePath();
modelPath = modelPath.substring(0, modelPath.lastIndexOf('.')) + ".json";
IResource resource = this.manager.getResource(new ResourceLocation(modelLocation.getResourceDomain(), modelPath));
InputStreamReader jsonStream = new InputStreamReader(resource.getInputStream());
JsonElement json = this.parser.parse(jsonStream);
jsonStream.close();
ModelBlock modelBlock = this.modelBlockDeserializer.deserialize(json, ModelBlock.class, this);
String tblLocationStr = json.getAsJsonObject().get("tabula").getAsString() + ".tbl";
ResourceLocation tblLocation = new ResourceLocation(tblLocationStr);
IResource tblResource = this.manager.getResource(tblLocation);
InputStream modelStream = this.getModelJsonStream(tblLocation.toString(), tblResource.getInputStream());
TabulaModelContainer modelJson = TabulaModelHandler.INSTANCE.loadTabulaModel(modelStream);
modelStream.close();
ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
int layer = 0;
String texture;
while ((texture = modelBlock.textures.get("layer" + layer++)) != null) {
builder.add(new ResourceLocation(texture));
}
String particle = modelBlock.textures.get("particle");
return new VanillaTabulaModel(modelJson, particle != null ? new ResourceLocation(particle) : null, builder.build(), IPerspectiveAwareModel.MapWrapper.getTransforms(modelBlock.getAllTransforms()));
}