From ccd226b78d25ae9a4244d52409f0f0ea91d95747 Mon Sep 17 00:00:00 2001 From: Xel'Bayria <12866666+Xelbayria@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:43:03 -0700 Subject: [PATCH] AbstractSimpleEntrySet: Fixed #743 --- .../api/AbstractSimpleEntrySet.java | 18 ++++++++++++------ .../FunctionalStorageModule.java | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/net/mehvahdjukaar/every_compat/api/AbstractSimpleEntrySet.java b/common/src/main/java/net/mehvahdjukaar/every_compat/api/AbstractSimpleEntrySet.java index c861f7d80..9bfdd1557 100644 --- a/common/src/main/java/net/mehvahdjukaar/every_compat/api/AbstractSimpleEntrySet.java +++ b/common/src/main/java/net/mehvahdjukaar/every_compat/api/AbstractSimpleEntrySet.java @@ -275,6 +275,7 @@ public void generateTextures(SimpleModule module, DynClientResourcesGenerator ha Multimap infoPerTextures = ArrayListMultimap.create(); + /// Adding multiple textures from one block into Respriter without/with mask & infoPerTextures for (var textureInfo : textures) { ResourceLocation textureId = textureInfo.texture(); @@ -329,7 +330,7 @@ public void generateTextures(SimpleModule module, DynClientResourcesGenerator ha for (var e : partialRespriters.entrySet()) { respriters.put(e.getKey(), Respriter.ofPalette(e.getValue(), globalPalette)); } - + /// Swapping out the old palettes of the texture with new plattes for (var entry : getDefaultEntries().entrySet()) { var b = entry.getValue(); T w = entry.getKey(); @@ -350,6 +351,7 @@ public void generateTextures(SimpleModule module, DynClientResourcesGenerator ha //sanity check to verity that palette isn't changed. can be removed int oldSize = targetPalette.get(0).size(); + /// Creating new Path to add the new textures via the resources for (var re : respriters.entrySet()) { if (oldSize != targetPalette.get(0).size()) { throw new RuntimeException("This should not happen"); @@ -357,23 +359,27 @@ public void generateTextures(SimpleModule module, DynClientResourcesGenerator ha ResourceLocation oldTextureId = re.getKey(); String oldPath = oldTextureId.getPath(); - //// BlockTypeResTransformer.replaceFullGenericType(oldPath, w, blockId, baseType.get().getTypeName(), null, 2); Solve Boatload's texture issue - // boatload's texture path has 2 folder String newPath = (oldPath.startsWith("entity/") && module.modId.equals("boatload")) ? BlockTypeResTransformer.replaceFullGenericType(oldPath, w, blockId, baseType.get().getTypeName(), null, 2) // Default : BlockTypeResTransformer.replaceTypeNoNamespace(oldPath, w, blockId, baseType.get().getTypeName()); - String newId = new ResourceLocation(blockId.getNamespace(), newPath).toString(); + String newId = ""; boolean isOnAtlas = true; + /// Adding the textures to the resource for (var info : infoPerTextures.get(oldTextureId)) { if (info != null) { - if (info.keepNamespace()) { - newId = oldTextureId.withPath(newPath).toString(); + if (info.keepNamespace()) newId = oldTextureId.withPath(newPath).toString(); + else newId = new ResourceLocation(blockId.getNamespace(), newPath).toString(); + + if (newId.isEmpty()) { + EveryCompat.LOGGER.error("The path of new texture is empty for: {}", info.texture()); + continue; } + isOnAtlas = info.onAtlas(); /// TEMP: do not remove this until the mcmeta problem is fixed. diff --git a/forge/src/main/java/net/mehvahdjukaar/every_compat/modules/forge/functional_storage/FunctionalStorageModule.java b/forge/src/main/java/net/mehvahdjukaar/every_compat/modules/forge/functional_storage/FunctionalStorageModule.java index 2b8a4ee54..9cdd453e1 100644 --- a/forge/src/main/java/net/mehvahdjukaar/every_compat/modules/forge/functional_storage/FunctionalStorageModule.java +++ b/forge/src/main/java/net/mehvahdjukaar/every_compat/modules/forge/functional_storage/FunctionalStorageModule.java @@ -41,8 +41,8 @@ public FunctionalStorageModule(String modId) { ) .addTile(getModTile("oak_1")) .addCustomItem((wood, block, properties) -> new DrawerBlock.DrawerItem(block, properties, FunctionalStorage.TAB)) - .addTexture(modRes("block/oak_front_1")) .addTextureM(modRes("block/oak_side"), EveryCompat.res("block/fs/oak_side_m")) + .addTexture(modRes("block/oak_front_1")) .addTexture(TextureInfo.of(modRes("block/oak_front_1")) .forEntityOrGui() .keepNamespace())