Skip to content

Commit

Permalink
AbstractSimpleEntrySet: Fixed #743
Browse files Browse the repository at this point in the history
  • Loading branch information
Xelbayria committed Dec 29, 2024
1 parent cd3b1ca commit ccd226b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ public void generateTextures(SimpleModule module, DynClientResourcesGenerator ha

Multimap<ResourceLocation, TextureInfo> infoPerTextures = ArrayListMultimap.create();

/// Adding multiple textures from one block into Respriter without/with mask & infoPerTextures
for (var textureInfo : textures) {
ResourceLocation textureId = textureInfo.texture();

Expand Down Expand Up @@ -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();
Expand All @@ -350,30 +351,35 @@ 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");
}
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit ccd226b

Please sign in to comment.