From 736f838416a4f96c6e0c23a6658381835096993d Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Sat, 27 Aug 2022 13:45:34 +0300 Subject: Fixed texture cits not changing spawn eggs Fixes #169 --- .../shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- cgit