aboutsummaryrefslogtreecommitdiff
path: root/defaults/src/main/java
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-08-27 13:45:34 +0300
committerSHsuperCM <shsupercm@gmail.com>2022-08-27 13:45:34 +0300
commit736f838416a4f96c6e0c23a6658381835096993d (patch)
tree4d0813bd9c57de91103c6ba4a5f40e01c7764238 /defaults/src/main/java
parentf9b7a675d559d1f16c6d88a282629c8783ea595d (diff)
downloadCITResewn-736f838416a4f96c6e0c23a6658381835096993d.tar.gz
CITResewn-736f838416a4f96c6e0c23a6658381835096993d.tar.bz2
CITResewn-736f838416a4f96c6e0c23a6658381835096993d.zip
Fixed texture cits not changing spawn eggs
Fixes #169
Diffstat (limited to 'defaults/src/main/java')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
index ee1fef0..e9450a4 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
@@ -428,6 +428,13 @@ public class TypeItem extends CITType {
try (InputStream is = resourceManager.getResource(firstItemModelIdentifier).orElseThrow().getInputStream()) {
JsonUnbakedModel json = JsonUnbakedModel.deserialize(IOUtils.toString(is, StandardCharsets.UTF_8));
+ if (((JsonUnbakedModelAccessor) json).getParentId().equals(new Identifier("minecraft", "item/template_spawn_egg"))) { // HOTFIX: Fixes not being able to change spawn eggs using texture cits
+ try (InputStream parentInputStream = resourceManager.getResource(new Identifier("minecraft", "models/item/template_spawn_egg.json")).orElseThrow().getInputStream()) {
+ json = JsonUnbakedModel.deserialize(IOUtils.toString(parentInputStream, StandardCharsets.UTF_8));
+ ((JsonUnbakedModelAccessor) json).getTextureMap().remove("layer1"); // PARITY
+ }
+ }
+
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);