diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java index 31f786c45..770de7b69 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java @@ -16,6 +16,7 @@ import net.minecraft.util.Pair; import net.minecraft.util.StringIdentifiable; import net.minecraft.registry.Registry; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; @@ -49,38 +50,41 @@ public static BlockType getBlockType(Identifier identifier) { public static VariantBase getVariant(Identifier identifier) { VariantBase var = getExtraCounterType(identifier); - if (var == ExtraCounterVariant.DEEPSLATE_TILE && !identifier.getPath().contains("deepslate_tile")) { + if (var == null) { var = getStoneType(identifier); } - if ((var == StoneVariant.STONE && !identifier.getPath().contains("stone")) || (var == ExtraCounterVariant.DEEPSLATE_TILE && !identifier.getPath().contains("deepslate_tile"))) { + if (var == null) { var = getWoodType(identifier); } return var; } + @Nullable public static ExtraCounterVariant getExtraCounterType(Identifier identifier) { for (ExtraCounterVariant variant: ExtraCounterVariant.values()) { - if (identifier.getPath().contains(variant.getPath())) { + if (identifier.getPath().contains(variant.getPath()) && getBlockType(identifier) == BlockType.BLOCK) { return variant; } } - return ExtraCounterVariant.DEEPSLATE_TILE; + return null; } + + @Nullable public static StoneVariant getStoneType(Identifier identifier) { for (StoneVariant variant: StoneVariant.values()) { - if (identifier.getPath().contains(variant.getPath())) { + if (identifier.getPath().contains(variant.getPath()) && getBlockType(identifier) == BlockType.BLOCK) { return variant; } } - return StoneVariant.STONE; + return null; } public static WoodVariant getWoodType(Identifier identifier){ WoodVariant selectedVariant = null; for (WoodVariant woodVariant : WoodVariantRegistry.getVariants()) if (identifier.getPath().contains(woodVariant.identifier.getPath())) { - if (identifier.getPath().contains("dark") && !woodVariant.identifier.getPath().contains("dark")) + if (identifier.getPath().contains("dark") && !woodVariant.identifier.getPath().contains("dark") || (!identifier.getPath().contains(woodVariant.getNamespace()) && !woodVariant.isVanilla())) continue; selectedVariant = woodVariant; } @@ -172,8 +176,10 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo id = getLogId(block, "_bottom"); } else { - PFMDataGen.LOGGER.warn("Couldn't find texture for, {}", block); - id = TextureMap.getId(Blocks.BEDROCK); + if (!Registries.BLOCK.getId(block).getNamespace().equals("quark")) { + PFMDataGen.LOGGER.warn("Couldn't find texture for, {}", block); + } + id = TextureMap.getSubId(block, postfix); } blockToTextureMap.put(pair, id); return id; @@ -183,15 +189,34 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo public static Identifier getPlankId(Block block) { Identifier identifier = Registries.BLOCK.getId(block); String namespace = identifier.getNamespace(); - String path = identifier.getPath(); + String path = identifier.getPath().replace("luphie_", ""); if (path.contains("planks")) { - path = path.replace("_planks", ""); + path = path.replace("_planks", "").replace("plank_", ""); + Identifier id = new Identifier(namespace, "block/" + path +"/planks"); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id; + path = "planks_" + path; - Identifier id = new Identifier(namespace, "block/wood/" + path); - path = path.replace("mining", "mine").replace("sorting", "sort").replace("transformation", "trans").replace("dark", "darkwood"); + id = new Identifier(namespace, "block/" + path); + path = path.replace("mining", "mine").replace("sorting", "sort").replace("transformation", "trans").replace("dark", "darkwood").replace("alpha_", "alpha_oak_").replace("flowering_pink", "flowerypink").replace("flowering_purple", "floweringpurple"); + Identifier id2 = new Identifier(namespace, "block/wood/" + path); + Identifier id3 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "planks"); + Identifier id4 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "_planks"); + Identifier id5 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "plankstext"); + Identifier id6 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "plankretext"); if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) return id; + else if (idExists(id2, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id2; + else if (idExists(id3, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id3; + else if (idExists(id4, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id4; + else if (idExists(id5, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id5; + else if (idExists(id6, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) + return id6; else return new Identifier(namespace, "block/wood/" + path+ "_0"); } @@ -202,9 +227,17 @@ public static Identifier getPlankId(Block block) { public static Identifier getLogId(Block block, String postFix) { Identifier identifier = Registries.BLOCK.getId(block); String namespace = identifier.getNamespace(); - String path = identifier.getPath(); - if (path.contains("log")) { - path = path.replace("log", "bark"); + String path = identifier.getPath().replace("luphie_", ""); + if (namespace.contains("luphieclutteredmod") && path.contains("flowering_log")) { + path = path.replace("flowering_log", "flowering_yellow_log"); + } + if (namespace.equals("byg") && path.contains("pedu")) + path = path.replace("pedu", "log"); + if (path.contains("log") || path.contains("stem")) { + if (!path.contains("_log")) { + path = path.replace("log", "_log"); + } + path = path.replace("stem", "log").replace("log", "bark"); path += postFix; Identifier id = new Identifier(namespace, "block/" + path); if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { @@ -238,6 +271,26 @@ public static Identifier getLogId(Block block, String postFix) { if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { return id; } + String loc = identifier.getPath().contains("stripped") || identifier.getPath().contains("striped") ? "stripped_log" : "log"; + path = path.replace("striped_", "").replace(postFix, "").replace("_log", ""); + if (!identifier.getPath().contains("stripped") && namespace.equals("byg")) + System.out.println("paused"); + id = new Identifier(namespace, "block/" + path+ "/" + loc + postFix); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } + id = new Identifier(namespace, "block/" + path+ "/" + loc.replace("log", "stem") + postFix); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } + id = new Identifier(namespace, "block/" + path+ "/" + loc); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } + id = new Identifier(namespace, "block/" + path+ "/" + loc.replace("log", "stem")); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } } else if (path.contains("reed")) { path = path.replace("nether_", "").replace("reed", "reeds"); Identifier id = new Identifier(namespace, "block/" + path); @@ -254,6 +307,18 @@ public static Identifier getLogId(Block block, String postFix) { return id; } } + if (path.contains("alpha_")) { + path = path.replace("alpha", "alpha_oak"); + Identifier id = new Identifier(namespace, "block/" + path); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)){ + return id; + } + path += postFix; + id = new Identifier(namespace, "block/" + path); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } + } return new Identifier(namespace, "block/" + path); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java index cc07656be..2528724bf 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java @@ -45,9 +45,8 @@ public class UnbakedBasicTableModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic")); } for(StoneVariant variant : StoneVariant.values()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic")); @@ -62,12 +61,11 @@ public class UnbakedBasicTableModel implements UnbakedModel { String newPart = part.replaceAll("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : BASIC_MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : BASIC_MODEL_PARTS_BASE) { + String newPart = part.replaceAll("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ for (String part : BASIC_MODEL_PARTS_BASE) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java index 13ad67d02..060f699c4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java @@ -49,10 +49,8 @@ public UnbakedClassicNightstandModel(VariantBase variant, List modelP for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/" + variant.asString() + "_classic_nightstand")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/stripped_" + variant.asString() + "_classic_nightstand")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/stripped_" + variant.asString() + "_classic_nightstand")); } for(StoneVariant variant : StoneVariant.values()){ @@ -69,13 +67,11 @@ public UnbakedClassicNightstandModel(VariantBase variant, List modelP String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - - for (String part : NIGHTSTAND_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : NIGHTSTAND_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java index aeaf97363..6b297a864 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java @@ -34,9 +34,8 @@ public class UnbakedClassicTableModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic")); } for(StoneVariant variant : StoneVariant.values()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic")); @@ -51,12 +50,11 @@ public class UnbakedClassicTableModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : CLASSIC_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : CLASSIC_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java index d85e8e703..ece3b8ad3 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java @@ -31,9 +31,8 @@ public class UnbakedDinnerTableModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/stripped_" + variant.asString() + "_dinner_table")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/stripped_" + variant.asString() + "_dinner_table")); } for(StoneVariant variant : StoneVariant.values()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table")); @@ -48,12 +47,11 @@ public class UnbakedDinnerTableModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : DINNER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ for (String part : DINNER_MODEL_PARTS_BASE) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java index 9fb329aa0..cff71b97f 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java @@ -37,9 +37,8 @@ public class UnbakedKitchenCabinetModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/" + variant.asString() + "_kitchen_cabinet")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/stripped_" + variant.asString() + "_kitchen_cabinet")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/stripped_" + variant.asString() + "_kitchen_cabinet")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -59,12 +58,11 @@ public class UnbakedKitchenCabinetModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : CABINET_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : CABINET_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java index 8abd6dfb6..15f5bba1e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java @@ -34,9 +34,8 @@ public class UnbakedKitchenCounterModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/" + variant.asString() + "_kitchen_counter")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/stripped_" + variant.asString() + "_kitchen_counter")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/stripped_" + variant.asString() + "_kitchen_counter")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -56,12 +55,11 @@ public class UnbakedKitchenCounterModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : COUNTER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java index 71e733857..d80b6bf90 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java @@ -33,9 +33,8 @@ public class UnbakedKitchenCounterOvenModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/" + variant.asString() + "_kitchen_counter_oven")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/stripped_" + variant.asString() + "_kitchen_counter_oven")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/stripped_" + variant.asString() + "_kitchen_counter_oven")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -55,12 +54,11 @@ public class UnbakedKitchenCounterOvenModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : OVEN_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : OVEN_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java index b146c4bb6..a7b17e29a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java @@ -41,9 +41,8 @@ public class UnbakedKitchenDrawerModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/" + variant.asString() + "_kitchen_drawer")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/stripped_" + variant.asString() + "_kitchen_drawer")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/stripped_" + variant.asString() + "_kitchen_drawer")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -63,12 +62,11 @@ public class UnbakedKitchenDrawerModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : COUNTER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java index 94b90e048..ff6cb72bc 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java @@ -32,9 +32,8 @@ public class UnbakedKitchenWallCounterModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/" + variant.asString() + "_kitchen_wall_counter")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/stripped_" + variant.asString() + "_kitchen_wall_counter")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/stripped_" + variant.asString() + "_kitchen_wall_counter")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -54,13 +53,13 @@ public class UnbakedKitchenWallCounterModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } + if (variant.hasStripped()) + for (String part : COUNTER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } + for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java index ad3a23084..b3a7782f6 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java @@ -37,9 +37,8 @@ public class UnbakedKitchenWallDrawerModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/" + variant.asString() + "_kitchen_wall_drawer")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/stripped_" + variant.asString() + "_kitchen_wall_drawer")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/stripped_" + variant.asString() + "_kitchen_wall_drawer")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) @@ -59,12 +58,11 @@ public class UnbakedKitchenWallDrawerModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : COUNTER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java index 7a1e68c4e..a9d8a50f8 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java @@ -32,18 +32,11 @@ public class UnbakedLogTableModel implements UnbakedModel { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ String logType = variant.isNetherWood() ? "stem" : "log"; add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_" + logType+ "_table")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - String logType = variant.isNetherWood() ? "stem" : "log"; add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_raw_" + logType+ "_table")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - String logType = variant.isNetherWood() ? "stem" : "log"; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_" + logType+ "_table")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - String logType = variant.isNetherWood() ? "stem" : "log"; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_raw_" + logType+ "_table")); + if (variant.hasStripped()) { + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_" + logType+ "_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_raw_" + logType+ "_table")); + } } for(StoneVariant variant : StoneVariant.values()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_natural_table")); @@ -60,29 +53,25 @@ public class UnbakedLogTableModel implements UnbakedModel { newPart = newPart.replace(variant.asString() + "_log", variant.asString() + "_stem"); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ for (String part : LOG_MODEL_PARTS_BASE) { String newPart = part.replace("template", variant.asString() + "_raw"); if (variant.isNetherWood()) newPart = newPart.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString() + "_raw"); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_log", variant.asString() + "_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + if (variant.hasStripped()) { + for (String part : LOG_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString() + "_raw"); + if (variant.isNetherWood()) + newPart = newPart.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } + for (String part : LOG_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + if (variant.isNetherWood()) + newPart = newPart.replace(variant.asString() + "_log", variant.asString() + "_stem"); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } } for(StoneVariant variant : StoneVariant.values()){ diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java index f7947ac08..97343630a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java @@ -31,9 +31,8 @@ public class UnbakedModernDinnerTableModel implements UnbakedModel { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/" + variant.asString() + "_table_modern_dinner")); - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/stripped_" + variant.asString() + "_table_modern_dinner")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/stripped_" + variant.asString() + "_table_modern_dinner")); } for(StoneVariant variant : StoneVariant.values()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/" + variant.asString() + "_table_modern_dinner")); @@ -48,12 +47,11 @@ public class UnbakedModernDinnerTableModel implements UnbakedModel { String newPart = part.replace("template", variant.asString()); add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + if (variant.hasStripped()) + for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { + String newPart = part.replace("template", "stripped_" + variant.asString()); + add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); + } } for(StoneVariant variant : StoneVariant.values()){ for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java index 55f852953..ac501de22 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java @@ -135,6 +135,18 @@ public static void compatInit() { "betternether", "nether_reed", "nether_reed_planks", "nether_reed_roof"); addBlockTypeFinder(WoodVariant.class, netherReed); + + WoodVariant.Finder clutteredFloweringYellow = WoodVariant.Finder.simple( + "luphieclutteredmod", "luphie_flowering_yellow", "luphie_flowering_yellow_planks", "luphie_flowering_yellow_log"); + clutteredFloweringYellow.addChild("wood", "luphie_flowering_yellow_wood"); + clutteredFloweringYellow.addChild("stripped_log", "stripped_luphie_flowering_log"); + clutteredFloweringYellow.addChild("stripped_wood", "stripped_luphie_flowering_wood"); + clutteredFloweringYellow.addChild("slab", "luphie_flowering_yellow_slab"); + clutteredFloweringYellow.addChild("fence", "luphie_flowering_yellow_fence"); + clutteredFloweringYellow.addChild("fence_gate", "luphie_flowering_yellow_fence_gate"); + clutteredFloweringYellow.addChild("button", "luphie_flowering_yellow_button"); + + addBlockTypeFinder(WoodVariant.class, clutteredFloweringYellow); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java index 93a4ac5b8..8555f80c1 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java @@ -46,7 +46,7 @@ public void registerBlockType(T newType) { builder.add(newType); } - public abstract Optional geVariantFromBlock(Block baseBlock, Identifier blockId); + public abstract Optional getVariantFromBlock(Block baseBlock, Identifier blockId); public void buildAll() { //adds default @@ -54,7 +54,7 @@ public void buildAll() { //adds finders finders.stream().map(VariantBase.SetFinder::get).forEach(f -> f.ifPresent(this::registerBlockType)); for (Block block : Registries.BLOCK) { - this.geVariantFromBlock(block, Registries.BLOCK.getId(block)).ifPresent(this::registerBlockType); + this.getVariantFromBlock(block, Registries.BLOCK.getId(block)).ifPresent(this::registerBlockType); } this.finalizeAndFreeze(); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java index 081c027ee..790d7daef 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java @@ -74,23 +74,45 @@ public String getPath() { @Nullable protected Block findLogRelatedBlock(String append, String postpend) { - if (this.isNetherWood() && postpend.equals("log") || postpend.equals("wood")) { - switch (postpend) { - case "log" -> postpend = "stem"; - case "wood" -> postpend = "hyphae"; - } - } String post = postpend.isEmpty() ? "" : "_" + postpend; - var id = this.getIdentifier(); + Identifier id = this.getIdentifier(); String logN = Registries.BLOCK.getId(this.logBlock).getPath(); Identifier[] targets = { new Identifier(id.getNamespace(), logN + "_" + append + post), + new Identifier(id.getNamespace(), logN + "_" + append + post.replace("_", "")), new Identifier(id.getNamespace(), append + "_" + logN + post), + new Identifier(id.getNamespace(), append + "_" + logN + post.replace("_", "")), new Identifier(id.getNamespace(), id.getPath() + "_" + append + post), - new Identifier(id.getNamespace(), append + "_" + id.getPath() + post) + new Identifier(id.getNamespace(), id.getPath() + "_" + append + post.replace("_", "")), + new Identifier(id.getNamespace(), append + "_" + id.getPath() + post), + new Identifier(id.getNamespace(), append + "_" + id.getPath() + post.replace("_", "")) }; + String postNether = ""; + switch (postpend) { + case "log" -> postNether = "stem"; + case "wood" -> postNether = "hyphae"; + } + postNether = postpend.isEmpty() ? "" : "_" + postNether; Block found = null; - for (var r : targets) { + if (!postNether.isEmpty()) { + Identifier[] nether_targets = { + new Identifier(id.getNamespace(), logN + "_" + append + postNether), + new Identifier(id.getNamespace(), logN + "_" + append + postNether.replace("_", "")), + new Identifier(id.getNamespace(), append + "_" + logN + postNether), + new Identifier(id.getNamespace(), append + "_" + logN + postNether.replace("_", "")), + new Identifier(id.getNamespace(), id.getPath() + "_" + append + postNether), + new Identifier(id.getNamespace(), id.getPath() + "_" + append + postNether.replace("_", "")), + new Identifier(id.getNamespace(), append + "_" + id.getPath() + postNether), + new Identifier(id.getNamespace(), append + "_" + id.getPath() + postNether.replace("_", "")) + }; + for (Identifier r : nether_targets) { + if (Registries.BLOCK.containsId(r)) { + found = Registries.BLOCK.get(r); + break; + } + } + } + for (Identifier r : targets) { if (Registries.BLOCK.containsId(r)) { found = Registries.BLOCK.get(r); break; @@ -167,7 +189,8 @@ public void initializeChildrenItems() { } public boolean hasStripped() { - return this.getChild("stripped_log") != null; + Object child = this.getChild("stripped_log"); + return child != null && child != this.getBaseBlock(); } @Override public Block mainChild() { @@ -213,6 +236,10 @@ public Optional get() { Block d = Registries.BLOCK.get(new Identifier("minecraft","air")); if (plank != d && log != d && plank != null && log != null) { WoodVariant w = new WoodVariant(id, plank, log); + for (Map.Entry entry : childNames.entrySet()){ + Object child = Registry.BLOCK.getOrEmpty(entry.getValue()).isPresent() ? Registry.BLOCK.get(entry.getValue()) : Registry.ITEM.get(entry.getValue()); + w.addChild(entry.getKey(), child); + } return Optional.of(w); } } catch (Exception ignored) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java index 2fa32fc7e..367785042 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java @@ -8,10 +8,15 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.stream.Collectors; public class WoodVariantRegistry extends VariantRegistryBase { public static final WoodVariant OAK = new WoodVariant(new Identifier("oak"), Blocks.OAK_PLANKS, Blocks.OAK_LOG, BoatEntity.Type.OAK); public static final WoodVariantRegistry INSTANCE = new WoodVariantRegistry(); + public static Collection getNamespaces() { + return INSTANCE.variants.values().stream().map(VariantBase::getNamespace).collect(Collectors.toUnmodifiableList()); + }; + public static Collection getVariants() { return Collections.unmodifiableCollection(INSTANCE.variants.values()); } @@ -21,7 +26,7 @@ public static WoodVariant getVariant(Identifier name) { } @Nullable - public static WoodVariant getVariantFromVanillaWoodType(BoatEntity.Type type) { + public static WoodVariant getVariantFromVanillaWoodType(BoatEntity.Type type) { for (WoodVariant woodVariant : INSTANCE.variants.values()) { if (woodVariant.getVanillaWoodType() == type) return woodVariant; @@ -31,10 +36,20 @@ public static WoodVariant getVariantFromVanillaWoodType(BoatEntity.Type type) { /** * Simplified Wood/Block detection based on MoonlightLib... */ - public Optional geVariantFromBlock(Block baseBlock, Identifier blockId) { + public Optional getVariantFromBlock(Block baseBlock, Identifier blockId) { String name = null; String path = blockId.getPath(); - + if (blockId.getNamespace().equals("tfc")) { + if (path.contains("wood/planks/")) { + Optional log = Registry.BLOCK.getOrEmpty( + new Identifier(blockId.getNamespace(), path.replace("planks", "log"))); + if (log.isPresent()) { + Identifier id = new Identifier(blockId.getNamespace(), path.replace("wood/planks/", "")); + return Optional.of(new WoodVariant(id, baseBlock, log.get())); + } + } + return Optional.empty(); + } if (path.endsWith("_planks")) { name = path.substring(0, path.length() - "_planks".length()); } else if (path.startsWith("planks_")) { @@ -84,8 +99,10 @@ private static Block findLog(Identifier id) { Identifier[] test = { new Identifier(id.getNamespace(), id.getPath() + "_log"), new Identifier(id.getNamespace(), "log_" + id.getPath()), + new Identifier(id.getNamespace(), id.getPath() + "log"), new Identifier(id.getPath() + "_log"), new Identifier("log_" + id.getPath()), + new Identifier(id.getPath() + "log"), new Identifier(id.getNamespace(), id.getPath() + "_stem"), new Identifier(id.getNamespace(), "stem_" + id.getPath()), new Identifier(id.getPath() + "_stem"), diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java index a5b843955..83b04ddb5 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java @@ -135,7 +135,12 @@ private static void collectFiles(File directory, List hashList, collectFiles(file, hashList, includeHiddenFiles); } else { FileInputStream stream = new FileInputStream(file); - hashList.add(HashCode.fromBytes(stream.readAllBytes()).toString()); + try { + HashCode code = HashCode.fromBytes(stream.readAllBytes()); + hashList.add(code.toString()); + } catch (Exception e) { + LOGGER.warn("File {} was less than 1 byte or invalid, skipping, {}", file.getName(), e); + } stream.close(); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java index 913824ff9..3398e398b 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java @@ -228,7 +228,7 @@ public String getTranslatedVariantName(VariantBase variant) { if (variant == WoodVariantRegistry.getVariantFromVanillaWoodType(BoatEntity.Type.BAMBOO)) { variantName.set(variantName.get().replace("Block of", "")); } - common.forEach(s -> variantName.set(String.join(!variantName.get().isEmpty() ? variantName.get() + " " : variantName.get(), s))); + variantName.set(String.join(" ", common)); return variantName.get(); } @@ -255,7 +255,7 @@ public void generateTranslationForBedMap(HashMap, ? extends List< public void generateTranslationForVariantBlockMap(Map, ? extends Block> variantBaseHashMap, BufferedWriter writer, String furnitureKey, QuadFunc blockStringStringStringStringQuadFunc) { variantBaseHashMap.forEach((variant, block) -> { - if (variant instanceof WoodVariant) { + if (variant instanceof WoodVariant && !variant.isVanilla()) { String translatedVariantName = getTranslatedVariantName(variant); String strippedKey = block.getTranslationKey().contains("stripped") ? translate("block.type.stripped") : ""; String translatedFurnitureName = StringUtils.normalizeSpace(blockStringStringStringStringQuadFunc.apply(block, furnitureKey, strippedKey, translatedVariantName)); diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json index 80e3886fe..84ca6a0de 100644 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json index b28973c53..a77ed3258 100644 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FurnitureRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FurnitureRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json index 8d5f20a7b..446ad8157 100644 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json index 80e3886fe..84ca6a0de 100755 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json index b28973c53..a77ed3258 100755 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FurnitureRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FurnitureRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json index 8d5f20a7b..446ad8157 100755 --- a/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json +++ b/fabric/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.fabric.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json index a135cdcb9..84ca6a0de 100644 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/freezingrecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json index a113b2182..a77ed3258 100644 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/furniturerecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FurnitureRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FurnitureRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json index 79907bea7..446ad8157 100644 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/en_us/templates/stoverecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json index a135cdcb9..84ca6a0de 100755 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/freezingrecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json index a113b2182..a77ed3258 100755 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/furniturerecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FurnitureRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FurnitureRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json index 79907bea7..446ad8157 100755 --- a/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json +++ b/forge/src/main/resources/data/pfm/patchouli_books/guide_book/zh_cn/templates/stoverecipetemplate.json @@ -1,5 +1,5 @@ { - "processor": "com.unlikepaladin.pfm.compat.forge.patchouli.FreezingRecipeProcessor", + "processor": "com.unlikepaladin.pfm.compat.patchouli.FreezingRecipeProcessor", "include": [ { "template": "pfm:namenumber", diff --git a/gradle.properties b/gradle.properties index 13468ef7c..56a1b7158 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.19.3 enabled_platforms=fabric,forge archives_base_name=paladin-furniture-mod -mod_version=1.2.0-rc3 +mod_version=1.2.0-rc4 maven_group=com.unlikepaladin architectury_version=5.12.42