diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-10-09 18:21:03 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-10-09 18:21:03 +0300 |
commit | e27a529bc99697f3dc7d4e6818a7ecb34285a458 (patch) | |
tree | 3a9330793456a9a20a09cc13ba161133a8d4c5d8 /src/main/java/shcm | |
parent | 3e60c7b5cf646fbda1c15b38877ba7e5022dd2e2 (diff) | |
download | CITResewn-e27a529bc99697f3dc7d4e6818a7ecb34285a458.tar.gz CITResewn-e27a529bc99697f3dc7d4e6818a7ecb34285a458.tar.bz2 CITResewn-e27a529bc99697f3dc7d4e6818a7ecb34285a458.zip |
Fixed ignored texture-based model duplicates
Fixes #44
Diffstat (limited to 'src/main/java/shcm')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java index 27655a1..fc47096 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java @@ -364,7 +364,15 @@ public class CITItem extends CIT { Identifier firstItemIdentifier = Registry.ITEM.getId(this.items.iterator().next()), firstItemModelIdentifier = new Identifier(firstItemIdentifier.getNamespace(), "models/item/" + firstItemIdentifier.getPath() + ".json"); Resource itemModelResource = null; try { - return JsonUnbakedModel.deserialize(IOUtils.toString((itemModelResource = resourceManager.getResource(firstItemModelIdentifier)).getInputStream(), StandardCharsets.UTF_8)); + JsonUnbakedModel json = JsonUnbakedModel.deserialize(IOUtils.toString((itemModelResource = resourceManager.getResource(firstItemModelIdentifier)).getInputStream(), StandardCharsets.UTF_8)); + + if (!GENERATED_SUB_CITS_SEEN.add(firstItemModelIdentifier)) // cit generated duplicate + firstItemModelIdentifier = new Identifier(firstItemModelIdentifier.getNamespace(), GENERATED_SUB_CITS_PREFIX + GENERATED_SUB_CITS_SEEN.size() + "_" + firstItemModelIdentifier.getPath()); + GENERATED_SUB_CITS_SEEN.add(firstItemModelIdentifier); + + json.id = firstItemModelIdentifier.toString(); + json.id = json.id.substring(0, json.id.length() - 5); + return json; } catch (Exception e) { return null; } finally { |