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 f773e7c90..a9d38f272 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 @@ -6,6 +6,7 @@ import com.unlikepaladin.pfm.runtime.PFMDataGen; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.client.texture.MissingSprite; import net.minecraft.data.client.model.Texture; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; @@ -14,6 +15,7 @@ import net.minecraft.util.Pair; import net.minecraft.util.StringIdentifiable; import net.minecraft.util.registry.Registry; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashMap; @@ -45,38 +47,41 @@ public static BlockType getBlockType(Identifier identifier) { public static VariantBase getVariant(Identifier identifier) { VariantBase var = getExtraCounterType(identifier); - if (!identifier.getPath().contains("deepslate_tile")) { + if (var == null) { var = getStoneType(identifier); } - if ((var == StoneVariant.STONE && !identifier.getPath().contains("stone"))) { + 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.DARK_CONCRETE; + 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; } @@ -169,7 +174,7 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo } else { PFMDataGen.LOGGER.warn("Couldn't find texture for, {}", block); - id = Texture.getId(Blocks.BEDROCK); + id = MissingSprite.getMissingSpriteId(); } blockToTextureMap.put(pair, id); return id; @@ -179,15 +184,34 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo public static Identifier getPlankId(Block block) { Identifier identifier = Registry.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"); } @@ -198,9 +222,17 @@ public static Identifier getPlankId(Block block) { public static Identifier getLogId(Block block, String postFix) { Identifier identifier = Registry.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)) { @@ -234,6 +266,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); @@ -250,6 +302,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 1602d94b3..dd158e1df 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 @@ -48,9 +48,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")); @@ -65,12 +64,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 c1e781529..10081da0f 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 @@ -52,10 +52,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()){ @@ -72,13 +70,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 764317463..74ab5af54 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 @@ -37,9 +37,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")); @@ -54,12 +53,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 aae8b4c2a..4ffb51249 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 @@ -34,9 +34,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")); @@ -51,12 +50,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 969112164..b12e8cafc 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 @@ -40,9 +40,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)) @@ -62,12 +61,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 6fd203764..9966e839f 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 @@ -37,9 +37,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)) @@ -59,12 +58,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 b10a4f497..9fa6f3ca5 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 @@ -36,9 +36,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)) @@ -58,12 +57,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 ca86790f4..8035518a0 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 @@ -44,9 +44,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)) @@ -66,12 +65,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 8d4fbddf4..bb0dea857 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 @@ -35,9 +35,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)) @@ -57,13 +56,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 05db60dba..5a55c9589 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 @@ -40,9 +40,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)) @@ -62,12 +61,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 cc6dbf38f..ca4e67c06 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 @@ -35,18 +35,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")); @@ -63,29 +56,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 f3b1d987e..a5ebb02ac 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 @@ -34,9 +34,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")); @@ -51,12 +50,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 d2ba0f6dc..ebd700575 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 @@ -129,6 +129,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 1bd697aaa..0a6cf6850 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 @@ -45,7 +45,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 @@ -53,7 +53,7 @@ public void buildAll() { //adds finders finders.stream().map(VariantBase.SetFinder::get).forEach(f -> f.ifPresent(this::registerBlockType)); for (Block block : Registry.BLOCK) { - this.geVariantFromBlock(block, Registry.BLOCK.getId(block)).ifPresent(this::registerBlockType); + this.getVariantFromBlock(block, Registry.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 05fe97e8a..4bfdc1dd1 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 @@ -14,10 +14,7 @@ import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.function.Supplier; public class WoodVariant extends VariantBase { @@ -71,22 +68,44 @@ 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"; break; - case "wood": postpend = "hyphae"; break; - } - } String post = postpend.isEmpty() ? "" : "_" + postpend; Identifier id = this.getIdentifier(); String logN = Registry.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"; break; + case "wood": postNether = "hyphae"; break; + } + postNether = postpend.isEmpty() ? "" : "_" + postNether; Block found = null; + 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 (Registry.BLOCK.containsId(r)) { + found = Registry.BLOCK.get(r); + break; + } + } + } for (Identifier r : targets) { if (Registry.BLOCK.containsId(r)) { found = Registry.BLOCK.get(r); @@ -167,7 +186,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 +233,10 @@ public Optional get() { Block d = Registry.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 7a0663799..64c226f66 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 @@ -7,10 +7,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()); } @@ -20,7 +25,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; @@ -30,10 +35,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_")) { @@ -83,8 +98,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 c4cef940b..f97c953c7 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java @@ -156,10 +156,16 @@ private static void collectFiles(File directory, List hashList, if (file.isDirectory()) { collectFiles(file, hashList, includeHiddenFiles); } else { - hashList.add(HashCode.fromBytes(Files.readAllBytes(file.toPath())).toString()); + try { + HashCode code = HashCode.fromBytes(Files.readAllBytes(file.toPath())); + hashList.add(code.toString()); + } catch (Exception e) { + LOGGER.warn("File {} was less than 1 byte or invalid, skipping, {}", file.getName(), e); + } } } } } } + } \ No newline at end of file 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 e27663ac8..afa09d33b 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 @@ -222,7 +222,7 @@ public String getTranslatedVariantName(VariantBase variant) { String baseBlockName = translate(variant.getBaseBlock().getTranslationKey()); List common = findCommonWords(variantName.get(), baseBlockName); variantName.set(""); - common.forEach(s -> variantName.set(String.join(!variantName.get().isEmpty() ? variantName.get() + " " : variantName.get(), s))); + variantName.set(String.join(" ", common)); return variantName.get(); } diff --git a/gradle.properties b/gradle.properties index b4a223da4..05beb557e 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.16.5 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=1.32.66