diff --git a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java index 44235746f..74058e83f 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java +++ b/common/src/main/java/com/unlikepaladin/pfm/PaladinFurnitureMod.java @@ -11,6 +11,7 @@ import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig; import com.unlikepaladin.pfm.data.materials.DynamicBlockRegistry; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import com.unlikepaladin.pfm.mixin.PFMPointOfInterestTypeAccessor; import com.unlikepaladin.pfm.registry.BlockEntityRegistry; @@ -52,6 +53,8 @@ public void commonInit() { updateChecker = new PaladinFurnitureModUpdateChecker(); updateChecker.checkForUpdates(getPFMConfig()); DynamicBlockRegistry.addBlockSetContainer(WoodVariantRegistry.INSTANCE.getType(), WoodVariantRegistry.INSTANCE); + DynamicBlockRegistry.addBlockSetContainer(StoneVariantRegistry.INSTANCE.getType(), StoneVariantRegistry.INSTANCE); + if (getModList().contains("cookingforblockheads")) pfmModCompatibilities.add(PFMCookingForBlockheads.getInstance()); if (getModList().contains("farmersdelight")) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 9b63069aa..1fc642db9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -1,19 +1,15 @@ package com.unlikepaladin.pfm.blocks.models; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.LogStoolBlock; import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.data.materials.BlockType; -import com.unlikepaladin.pfm.data.materials.StoneVariant; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import com.unlikepaladin.pfm.runtime.data.PFMRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.entity.BedBlockEntity; import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; 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 1ab1c9cf3..15df269ab 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 @@ -103,8 +103,7 @@ public static ExtraCounterVariant getExtraCounterType(Identifier identifier) { @Nullable public static StoneVariant getStoneType(Identifier identifier) { - for (StoneVariant variant: - StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { if (identifier.getPath().contains(variant.getPath()) && getBlockType(identifier) == BlockType.BLOCK) { return variant; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java index 7b988a2dd..c3fa164b4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicCoffeeTable/UnbakedCoffeeBasicTableModel.java @@ -3,6 +3,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -51,7 +52,7 @@ public class UnbakedCoffeeBasicTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_coffee_table_basic")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_coffee_table_basic")); } add(TABLE_MODEL_ID); 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 ae8f3b3bd..7a2a4bfe7 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 @@ -10,7 +10,6 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; -import net.minecraft.util.math.AffineTransformation; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -47,7 +46,7 @@ public class UnbakedBasicTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_basic")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_basic")); } add(TABLE_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java index f772810f9..7f1c3111a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java @@ -3,6 +3,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -34,7 +35,7 @@ public class UnbakedChairModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java index cb8a2b17f..fe4ea4ca7 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java @@ -3,6 +3,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -34,8 +35,7 @@ public class UnbakedChairClassicModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_classic")); } - for(StoneVariant variant : StoneVariant.values()){ - + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_classic")); } add(CHAIR_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java index cca714948..590056a07 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java @@ -2,9 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -34,7 +32,7 @@ public class UnbakedChairDinnerModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_dinner")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_dinner")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java index 14ac2f47f..96f9741d2 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java @@ -3,6 +3,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -34,8 +35,7 @@ public class UnbakedChairModernModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_modern")); } - for(StoneVariant variant : StoneVariant.values()){ - + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_modern")); } add(CHAIR_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java index 42b3be168..db01b0a0e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicCoffeeTable/UnbakedClassicCoffeeTableModel.java @@ -3,6 +3,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -41,7 +42,7 @@ public class UnbakedClassicCoffeeTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_coffee_table_classic")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_coffee_table_classic")); } add(TABLE_MODEL_ID); 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 61747c162..62fca7518 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 @@ -9,7 +9,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -39,7 +38,7 @@ public class UnbakedClassicNightstandModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_classic_nightstand")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_nightstand")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java index 97518d9c2..f560a4f5d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java @@ -2,8 +2,8 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.ExtraStoolVariant; import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.StoneVariantRegistry; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -34,7 +34,7 @@ public class UnbakedClassicStoolModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_classic_stool")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_stool")); } add(STOOL_MODEL_ID); 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 316cc30a5..a0146058f 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 @@ -11,7 +11,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -40,7 +39,7 @@ public class UnbakedClassicTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_classic")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_classic")); } add(TABLE_MODEL_ID); 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 d3bb35e3e..59c2b0e68 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -37,7 +36,7 @@ public class UnbakedDinnerTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_dinner")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_dinner")); } add(TABLE_MODEL_ID); 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 6f082be16..ba93a568e 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -43,8 +42,8 @@ public class UnbakedKitchenCabinetModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_cabinet")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_cabinet")); } 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 7f4942a0d..fece8f9ed 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -41,8 +40,8 @@ public class UnbakedKitchenCounterModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_counter")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter")); } 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 9f7d06f3d..3488d009f 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 @@ -11,7 +11,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -40,8 +39,8 @@ public class UnbakedKitchenCounterOvenModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_counter_oven")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter_oven")); } 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 f73fdbf48..806573921 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -47,8 +46,8 @@ public class UnbakedKitchenDrawerModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_drawer")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_drawer")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java index 59adc8ff7..decf7e75e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java @@ -36,8 +36,8 @@ public class UnbakedKitchenSinkModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_sink")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_sink")); } 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 b5e7d1b06..59393d996 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 @@ -37,8 +37,8 @@ public class UnbakedKitchenWallCounterModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_counter")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_counter")); } 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 0c94bf51f..769ac611e 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -44,8 +43,8 @@ public class UnbakedKitchenWallDrawerModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_drawer")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_drawer")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java index 2fc3ea970..1fad2ebae 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java @@ -1,10 +1,7 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.ExtraCounterVariant; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -37,8 +34,8 @@ public class UnbakedKitchenWallDrawerSmallModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_small_drawer")); } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ + if (variant.identifier.getPath().equals("quartz")) continue; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_small_drawer")); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java index 845c974a1..ee0db5de7 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java @@ -2,9 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -29,15 +27,10 @@ public class UnbakedLadderModel implements UnbakedModel { public static final List LADDER_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_bunk_ladder")); if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_simple_bunk_ladder")); } - for(StoneVariant variant : StoneVariant.values()){ - - add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_bunk_ladder")); - } add(LADDER_MODEL_ID); } }; diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java index 389650014..dfa0d97b4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java @@ -2,9 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -34,7 +32,7 @@ public class UnbakedLogStoolModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_" + logType + "_stool")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_log_stool")); } add(STOOL_MODEL_ID); 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 5fb44fda1..58c1f3c53 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -41,7 +40,7 @@ public class UnbakedLogTableModel implements UnbakedModel { add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_raw_table_" + logType)); } } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_natural")); } add(TABLE_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java index 767b749b6..f0cd655a4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernCoffeeTable/UnbakedModernCoffeeTableModel.java @@ -1,9 +1,7 @@ package com.unlikepaladin.pfm.blocks.models.modernCoffeeTable; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -40,7 +38,7 @@ public class UnbakedModernCoffeeTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_coffee_table_modern")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_coffee_table_modern")); } add(TABLE_MODEL_ID); 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 823f30513..fc94fbfde 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 @@ -10,7 +10,6 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -39,7 +38,7 @@ public class UnbakedModernDinnerTableModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_modern_dinner")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_modern_dinner")); } add(TABLE_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java index d8ee10e04..840a79a52 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java @@ -2,10 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.ExtraStoolVariant; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -34,7 +31,7 @@ public class UnbakedModernStoolModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_modern_stool")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_modern_stool")); } for(ExtraStoolVariant variant : ExtraStoolVariant.values()){ diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java index da390cf5d..035933902 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java @@ -2,9 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.StoneVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -34,7 +32,7 @@ public class UnbakedSimpleStoolModel implements UnbakedModel { if (variant.hasStripped()) add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_simple_stool")); } - for(StoneVariant variant : StoneVariant.values()){ + for(StoneVariant variant : StoneVariantRegistry.getVariants()){ add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_stool")); } 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 c51b7bc7c..b00ba78f6 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 @@ -1,12 +1,5 @@ package com.unlikepaladin.pfm.data.materials; -import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.blocks.BasicChairBlock; -import com.unlikepaladin.pfm.blocks.DinnerChairBlock; -import com.unlikepaladin.pfm.registry.dynamic.FurnitureEntry; -import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; -import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry; -import net.minecraft.block.AbstractBlock; import net.minecraft.util.Identifier; import java.util.Map; @@ -148,6 +141,32 @@ public static void compatInit() { clutteredFloweringYellow.addChild("button", "luphie_flowering_yellow_button"); addBlockTypeFinder(WoodVariant.class, clutteredFloweringYellow); + + // Stones + StoneVariant.Finder calcite = StoneVariant.Finder.simple( + "minecraft", "calcite", "calcite", "stripped_warped_stem"); + + addBlockTypeFinder(StoneVariant.class, calcite); + + StoneVariant.Finder lightWood = StoneVariant.Finder.simple( + "minecraft", "light_wood", "quartz_block", "stripped_oak_log"); + + addBlockTypeFinder(StoneVariant.class, lightWood); + + StoneVariant.Finder darkWood = StoneVariant.Finder.simple( + "minecraft", "dark_wood", "quartz_block", "stripped_dark_oak_log"); + + addBlockTypeFinder(StoneVariant.class, darkWood); + + StoneVariant.Finder quartz = StoneVariant.Finder.simple( + "minecraft", "quartz", "quartz_block", "quartz_block"); + + addBlockTypeFinder(StoneVariant.class, quartz); + + StoneVariant.Finder netherite = StoneVariant.Finder.simple( + "minecraft", "netherite", "netherite_block", "ancient_debris"); + + addBlockTypeFinder(StoneVariant.class, netherite); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java index 118426917..acfc85348 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java @@ -1,91 +1,75 @@ package com.unlikepaladin.pfm.data.materials; +import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.models.ModelHelper; +import com.unlikepaladin.pfm.registry.BlockItemRegistry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.block.Material; -import net.minecraft.client.render.block.BlockModels; import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; -import java.util.ArrayList; -import java.util.List; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; public class StoneVariant extends VariantBase { - public static StoneVariant QUARTZ = new StoneVariant(Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, "quartz"); - public static StoneVariant NETHERITE = new StoneVariant(Blocks.NETHERITE_BLOCK, Blocks.ANCIENT_DEBRIS,"netherite"); - public static StoneVariant LIGHT_WOOD = new StoneVariant(Blocks.QUARTZ_BLOCK, Blocks.STRIPPED_OAK_LOG, "light_wood"); - public static StoneVariant DARK_WOOD = new StoneVariant(Blocks.QUARTZ_BLOCK, Blocks.STRIPPED_DARK_OAK_LOG,"dark_wood"); - public static StoneVariant GRANITE = new StoneVariant(Blocks.POLISHED_GRANITE, Blocks.GRANITE,"granite"); - public static StoneVariant CALCITE = new StoneVariant(Blocks.CALCITE, Blocks.STRIPPED_WARPED_STEM,"calcite"); - public static StoneVariant ANDESITE = new StoneVariant(Blocks.POLISHED_ANDESITE, Blocks.ANDESITE, "andesite"); - public static StoneVariant DIORITE = new StoneVariant(Blocks.POLISHED_DIORITE, Blocks.DIORITE,"diorite"); - public static StoneVariant DEEPSLATE = new StoneVariant(Blocks.POLISHED_DEEPSLATE, Blocks.DEEPSLATE,"deepslate"); - public static StoneVariant BLACKSTONE = new StoneVariant(Blocks.POLISHED_BLACKSTONE, Blocks.BLACKSTONE,"blackstone"); - public static StoneVariant STONE = new StoneVariant(Blocks.STONE, Blocks.COBBLESTONE, "stone"); - - static final List DEFAULT_VARIANTS = new ArrayList<>(); - - static { - DEFAULT_VARIANTS.add(QUARTZ); - DEFAULT_VARIANTS.add(NETHERITE); - DEFAULT_VARIANTS.add(LIGHT_WOOD); - DEFAULT_VARIANTS.add(DARK_WOOD); - DEFAULT_VARIANTS.add(GRANITE); - DEFAULT_VARIANTS.add(CALCITE); - DEFAULT_VARIANTS.add(ANDESITE); - DEFAULT_VARIANTS.add(DIORITE); - DEFAULT_VARIANTS.add(DEEPSLATE); - DEFAULT_VARIANTS.add(BLACKSTONE); - DEFAULT_VARIANTS.add(STONE); - } - - public static List values() { - return DEFAULT_VARIANTS; - } - private final String name; - private final Block baseBlock; - private final Block secondaryBlock; - StoneVariant(Identifier identifier, Block baseBlock, Block secondaryBlock) { + private final Block polishedBlock; + private final Block rawBlock; + private final Material vanillaMaterial; + + StoneVariant(Identifier identifier, Block polishedBlock, Block rawBlock) { super(identifier); - this.name = identifier.getPath(); - this.baseBlock = baseBlock; - this.secondaryBlock = secondaryBlock; + this.polishedBlock = polishedBlock; + this.rawBlock = rawBlock; + this.vanillaMaterial = polishedBlock.getDefaultState().getMaterial(); } - StoneVariant(Block baseBlock, Block secondaryBlock, String name) { - this(new Identifier("", name), baseBlock, secondaryBlock); - } @Override public String asString() { - return name; + String postfix = this.isVanilla() ? "" : "_"+this.getNamespace(); + return this.identifier.getPath()+postfix; } + @Environment(EnvType.CLIENT) @Override - public Block getBaseBlock() { - return baseBlock; + public Identifier getTexture(BlockType type) { + if (type == BlockType.SECONDARY) + return ModelHelper.getTextureId(rawBlock); + return ModelHelper.getTextureId(polishedBlock); } @Override - public Block getSecondaryBlock() { - return secondaryBlock; + public String getPath() { + return this.identifier.getPath(); } @Override - public boolean isNetherWood() { - return false; + public Block getBaseBlock() { + return this.polishedBlock; } @Override - public Material getVanillaMaterial() { - return baseBlock.getDefaultState().getMaterial(); + public Block getSecondaryBlock() { + return rawBlock; } - @Override - public StoneVariant getVariantType() { - return this; + public Block getRawBlock() { + return rawBlock; + } + + public String toString() { + return this.identifier.toString(); + } + + public boolean isNetherWood() { + return this.identifier.getPath().contains("warped") || this.identifier.getPath().contains("crimson"); + } + + public Material getVanillaMaterial() { + return vanillaMaterial; } @Override @@ -94,30 +78,80 @@ public boolean isVanilla() { } @Override - public void initializeChildrenBlocks() { - + public StoneVariant getVariantType() { + return StoneVariant.this; } @Override - public void initializeChildrenItems() { - + public void initializeChildrenBlocks() { + this.addChild("slab", this.findRelatedEntry("slab", Registry.BLOCK)); + this.addChild("stairs", this.findRelatedEntry("stairs", Registry.BLOCK)); + this.addChild("wall", this.findRelatedEntry("fence", Registry.BLOCK)); } @Override - public Block mainChild() { - return STONE.baseBlock; + public void initializeChildrenItems() { } - @Environment(EnvType.CLIENT) - @Override - public Identifier getTexture(BlockType type) { - if (type == BlockType.SECONDARY) - return ModelHelper.getTextureId(secondaryBlock); - return ModelHelper.getTextureId(baseBlock); + public boolean hasStripped() { + Object child = this.getChild("stripped_log"); + return child != null && child != this.getBaseBlock(); } - @Override - public String getPath() { - return this.identifier.getPath(); + public Block mainChild() { + return this.polishedBlock; + } + + public static class Finder implements SetFinder { + + private final Map childNames = new HashMap<>(); + private final Supplier polishedFinder; + private final Supplier rawFinder; + private final Identifier id; + + public Finder(Identifier id, Supplier polished, Supplier raw) { + this.id = id; + this.polishedFinder = polished; + this.rawFinder = raw; + } + + public static Finder simple(String modId, String stoneTypeName, String polishedName, String rawName) { + return simple(new Identifier(modId, stoneTypeName), new Identifier(modId, polishedName), new Identifier(modId, rawName)); + } + + public static Finder simple(Identifier stoneTypeName, Identifier polishedName, Identifier rawName) { + return new Finder(stoneTypeName, + () -> Registry.BLOCK.get(polishedName), + () -> Registry.BLOCK.get(rawName)); + } + + public void addChild(String childType, String childName) { + addChild(childType, new Identifier(id.getNamespace(), childName)); + } + + public void addChild(String childType, Identifier childName) { + this.childNames.put(childType, childName); + } + + public Optional get() { + if (BlockItemRegistry.isModLoaded(id.getNamespace())) { + try { + Block plank = polishedFinder.get(); + Block log = rawFinder.get(); + Block d = Registry.BLOCK.get(new Identifier("minecraft","air")); + if (plank != d && log != d && plank != null && log != null) { + StoneVariant w = new StoneVariant(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) { + } + PaladinFurnitureMod.GENERAL_LOGGER.warn("Failed to find custom stone type {}", id); + } + return Optional.empty(); + } } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java new file mode 100644 index 000000000..b038a8d4b --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java @@ -0,0 +1,109 @@ +package com.unlikepaladin.pfm.data.materials; + +import net.minecraft.block.*; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.Collections; +import java.util.Optional; +import java.util.stream.Collectors; + +public class StoneVariantRegistry extends VariantRegistryBase { + public static final StoneVariant STONE = new StoneVariant(new Identifier("stone"), Blocks.STONE, Blocks.COBBLESTONE); + public static final StoneVariantRegistry INSTANCE = new StoneVariantRegistry(); + 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()); + } + @Nullable + public static StoneVariant getVariant(Identifier name) { + return INSTANCE.variants.getOrDefault(name, STONE); + } + + /** + * Simplified Wood/Block detection based on MoonlightLib... + */ + public Optional getVariantFromBlock(Block baseBlock, Identifier blockId) { + String name = null; + String path = blockId.getPath(); + if (path.endsWith("_polished")) { + name = path.substring(0, path.length() - "_polished".length()); + } else if (path.startsWith("polished_")) { + name = path.substring("polished_".length()); + } else if (path.endsWith("_polish")) { + name = path.substring(0, path.length() - "_polish".length()); + } else if (path.startsWith("polish_")) { + name = path.substring("polish_".length()); + } + String namespace = blockId.getNamespace(); + if (!namespace.equals("cozy_home") && name != null && !namespace.equals("securitycraft") && + !namespace.equals("absentbydesign") && !namespace.equals("chipped")) { + + BlockState state = baseBlock.getDefaultState(); + // can't check if the block is a full one, so I do this. Adding some checks here + if (state.getProperties().size() <= 2 && !(baseBlock instanceof SlabBlock)) { + // needs to use wood sound type + // if (state.getSoundType() == SoundType.WOOD) { //wood from tcon has diff sounds + Material mat = state.getMaterial(); + // and have correct material + if (mat == Material.STONE) { + // we do not allow "/" in the wood name + name = name.replace("/", "_"); + Identifier id = new Identifier(blockId.getNamespace(), name); + Block rawBlock = findRaw(id); + if (rawBlock != null) { + return Optional.of(new StoneVariant(id, baseBlock, rawBlock)); + } + } + } + } + return Optional.empty(); + } + + @Override + public StoneVariant getDefaultType() { + return STONE; + } + + @Override + public Class getType() { + return StoneVariant.class; + } + + @Nullable + private static Block findRaw(Identifier id) { + Identifier[] test = { + new Identifier(id.getNamespace(), id.getPath()), + new Identifier(id.getNamespace(), id.getPath() + "raw"), + new Identifier(id.getNamespace(), id.getPath() + "_raw"), + new Identifier(id.getNamespace(), "raw_" + id.getPath()), + new Identifier(id.getNamespace(), "raw" + id.getPath()), + new Identifier(id.getNamespace(), id.getPath() + "_cobble"), + new Identifier(id.getNamespace(), id.getPath() + "cobble"), + new Identifier(id.getNamespace(), "cobble_" + id.getPath()), + new Identifier(id.getNamespace(), "cobble" + id.getPath()), + new Identifier(id.getPath()), + new Identifier(id.getPath() + "raw"), + new Identifier(id.getPath() + "_raw"), + new Identifier("raw_" + id.getPath()), + new Identifier("raw" + id.getPath()), + new Identifier(id.getPath() + "_cobble"), + new Identifier(id.getPath() + "cobble"), + new Identifier("cobble_" + id.getPath()), + new Identifier("cobble" + id.getPath()) + }; + Block temp = null; + for (Identifier r : test) { + if (Registry.BLOCK.containsId(r)) { + temp = Registry.BLOCK.get(r); + break; + } + } + return temp; + } +} 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 583e48568..cbdab166a 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 @@ -33,8 +33,8 @@ protected void finalizeAndFreeze() { if (Objects.equals(entry.getNamespace(), modId)) { if (!linkedHashMap.containsKey(entry.getIdentifier())) { linkedHashMap.put(entry.getIdentifier(), entry); - }else if (entry.getIdentifier() != WoodVariantRegistry.OAK.getIdentifier()) { - PaladinFurnitureMod.GENERAL_LOGGER.warn("Found block type with duplicate id ({}), skipping",entry.identifier); + } else if (entry.getIdentifier() != WoodVariantRegistry.OAK.getIdentifier()) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Found block type with duplicate id ({}), skipping", entry.identifier); } } }); diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java index 566290d5c..85d4b956c 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java @@ -56,7 +56,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_chair", () -> new BasicChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_chair", () -> new BasicChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(DinnerChairBlock.class, new FurnitureEntry<>() {{ @@ -65,7 +65,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_chair_dinner", () -> new DinnerChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_chair_dinner", () -> new DinnerChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicChairBlock.class, new FurnitureEntry<>() {{ @@ -74,7 +74,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_chair_classic", () -> new ClassicChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_chair_classic", () -> new ClassicChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicChairDyeableBlock.class, new FurnitureEntry<>() {{ @@ -89,7 +89,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_chair_modern", () -> new ModernChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_chair_modern", () -> new ModernChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(FroggyChairBlock.class, new FurnitureEntry<>() {{ @@ -119,7 +119,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_table_basic", () -> new BasicTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_table_basic", () -> new BasicTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicTableBlock.class, new FurnitureEntry<>() {{ @@ -128,7 +128,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_table_classic", () -> new ClassicTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_table_classic", () -> new ClassicTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); @@ -139,7 +139,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_table_" + postfix, () -> new LogTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_table_natural", () -> new LogTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); @@ -157,7 +157,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_table_dinner", () -> new DinnerTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_table_dinner", () -> new DinnerTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ModernDinnerTableBlock.class, new FurnitureEntry<>() {{ @@ -166,7 +166,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_table_modern_dinner", () -> new ModernDinnerTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_table_modern_dinner", () -> new ModernDinnerTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(BasicCoffeeTableBlock.class, new FurnitureEntry<>() {{ @@ -175,7 +175,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_coffee_table_basic", () -> new BasicCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_coffee_table_basic", () -> new BasicCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ModernCoffeeTableBlock.class, new FurnitureEntry<>() {{ @@ -184,7 +184,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_coffee_table_modern", () -> new ModernCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_coffee_table_modern", () -> new ModernCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicCoffeeTableBlock.class, new FurnitureEntry<>() {{ @@ -193,7 +193,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_coffee_table_classic", () -> new ClassicCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_coffee_table_classic", () -> new ClassicCoffeeTableBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicNightstandBlock.class, new FurnitureEntry<>() {{ @@ -202,7 +202,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_classic_nightstand", () -> new ClassicNightstandBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_classic_nightstand", () -> new ClassicNightstandBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(SimpleBedBlock.class, new FurnitureEntry<>() {{ @@ -233,7 +233,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_simple_stool", () -> new SimpleStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_simple_stool", () -> new SimpleStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicStoolBlock.class, new FurnitureEntry<>() {{ @@ -242,7 +242,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_classic_stool", () -> new ClassicStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_classic_stool", () -> new ClassicStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); @@ -252,7 +252,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat if (variant.hasStripped()) this.addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_modern_stool", () -> new ModernStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } - for (StoneVariant variant : StoneVariant.values()) { + for (StoneVariant variant : StoneVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_modern_stool", () -> new ModernStoolBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); } for (ExtraStoolVariant variant : ExtraStoolVariant.values()) { @@ -288,7 +288,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).addBlock(variant, LateBlockRegistry.registerLateBlock("stripped_" + variant.asString()+"_kitchen_wall_small_drawer", () -> new KitchenWallDrawerSmallBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), false); } } - for (StoneVariant variant : StoneVariant.values()) {if (variant == StoneVariant.QUARTZ) + for (StoneVariant variant : StoneVariantRegistry.getVariants()) {if (variant.identifier.getPath().equals("quartz")) continue; this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_kitchen_counter", () -> new KitchenCounterBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenDrawerBlock.class).addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_kitchen_drawer", () -> new KitchenDrawerBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java index 2783ad7a0..8bc8dd96a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java @@ -9,8 +9,6 @@ import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; import com.unlikepaladin.pfm.data.materials.StoneVariant; import com.unlikepaladin.pfm.data.materials.VariantBase; -import com.unlikepaladin.pfm.data.materials.WoodVariant; -import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import com.unlikepaladin.pfm.mixin.PFMTextureKeyFactory; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import com.unlikepaladin.pfm.registry.TriFunc; @@ -251,20 +249,20 @@ public static Texture createPlankLogBlockTexture(Boolean stripped, VariantBase variantBase) { Identifier counterBase = stripped ? ModelHelper.getTextureId((Block) variantBase.getChild("stripped_log")) : ModelHelper.getTextureId(variantBase.getBaseBlock()); Identifier counterTop = stripped ? ModelHelper.getTextureId(variantBase.getBaseBlock()) : ModelHelper.getTextureId(variantBase.getSecondaryBlock()); - if (variantBase == StoneVariant.GRANITE) { + if (variantBase.identifier.getPath().equals("granite")) { counterTop = ModelHelper.getTextureId(Blocks.POLISHED_GRANITE); counterBase = ModelHelper.getTextureId(Blocks.WHITE_TERRACOTTA); - } else if (variantBase == StoneVariant.CALCITE || variantBase == StoneVariant.NETHERITE) { + } else if (variantBase.identifier.getPath().equals("calcite") || variantBase.identifier.getPath().equals("netherite")) { Identifier temp = counterBase; counterBase = counterTop; counterTop = temp; - } else if (variantBase == StoneVariant.ANDESITE) { + } else if (variantBase.identifier.getPath().equals("andesite")) { counterTop = ModelHelper.getTextureId(Blocks.POLISHED_ANDESITE); counterBase = ModelHelper.getTextureId(Blocks.STRIPPED_OAK_LOG); - } else if (variantBase == StoneVariant.DEEPSLATE) { + } else if (variantBase.identifier.getPath().equals("deepslate")) { counterTop = ModelHelper.getTextureId(Blocks.POLISHED_DEEPSLATE); counterBase = ModelHelper.getTextureId(Blocks.DARK_OAK_PLANKS); - } else if (variantBase == StoneVariant.BLACKSTONE) { + } else if (variantBase.identifier.getPath().equals("blackstone")) { counterTop = ModelHelper.getTextureId(Blocks.POLISHED_BLACKSTONE); counterBase = ModelHelper.getTextureId(Blocks.CRIMSON_PLANKS); } 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 93bcbb44f..15a537c11 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 @@ -281,7 +281,11 @@ public void generateTranslationForVariantBlockMap(Map, ? extends throw new RuntimeException(e); } } else { - String translatedVariantName = translate("block.pfm.variant."+variant.getIdentifier().getPath()); + String key = "block.pfm.variant."+variant.getIdentifier().getPath(); + String translatedVariantName = translate(key); + if (translatedVariantName.equals(key)) { + translatedVariantName = getTranslatedVariantName(variant); + } String translatedFurnitureName = StringUtils.normalizeSpace(blockStringStringStringStringQuadFunc.apply(block, furnitureKey, "", translatedVariantName)); try { writer.write(String.format(" \"%1$s\": \"%2$s\",", block.getTranslationKey(), translatedFurnitureName)); diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java index 809eab441..a1647f822 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java @@ -6,7 +6,6 @@ import com.unlikepaladin.pfm.blocks.*; import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.data.FurnitureBlock; -import com.unlikepaladin.pfm.data.materials.StoneVariant; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; @@ -697,20 +696,20 @@ public static Pair getCounterMaterials(VariantBase variantBase) Block counterTop = variantBase.getSecondaryBlock(); Block counterBase = variantBase.getBaseBlock(); - if (variantBase == StoneVariant.GRANITE) { + if (variantBase.identifier.getPath().equals("granite")) { counterTop = Blocks.POLISHED_GRANITE; counterBase = Blocks.WHITE_TERRACOTTA; - } else if (variantBase == StoneVariant.CALCITE || variantBase == StoneVariant.NETHERITE) { + } else if (variantBase.identifier.getPath().equals("calcite") || variantBase.identifier.getPath().equals("netherite")) { Block temp = counterBase; counterBase = counterTop; counterTop = temp; - } else if (variantBase == StoneVariant.ANDESITE) { + } else if (variantBase.identifier.getPath().equals("andesite")) { counterTop = Blocks.POLISHED_ANDESITE; counterBase = Blocks.STRIPPED_OAK_LOG; - } else if (variantBase == StoneVariant.DEEPSLATE) { + } else if (variantBase.identifier.getPath().equals("deepslate")) { counterTop = Blocks.POLISHED_DEEPSLATE; counterBase = Blocks.DARK_OAK_PLANKS; - } else if (variantBase == StoneVariant.BLACKSTONE) { + } else if (variantBase.identifier.getPath().equals("blackstone")) { counterTop = Blocks.POLISHED_BLACKSTONE; counterBase = Blocks.CRIMSON_PLANKS; } diff --git a/common/src/main/resources/assets/pfm/lang/en_us.json b/common/src/main/resources/assets/pfm/lang/en_us.json index a03b5e184..5e8a1e93d 100644 --- a/common/src/main/resources/assets/pfm/lang/en_us.json +++ b/common/src/main/resources/assets/pfm/lang/en_us.json @@ -300,13 +300,8 @@ "block.pfm.variant.netherite": "Netherite", "block.pfm.variant.light_wood": "Light Wood", "block.pfm.variant.dark_wood": "Dark Wood", - "block.pfm.variant.granite": "Granite", "block.pfm.variant.calcite": "Calcite", - "block.pfm.variant.andesite": "Andesite", "block.pfm.variant.stone": "Stone", - "block.pfm.variant.diorite": "Diorite", - "block.pfm.variant.deepslate": "Deepslate", - "block.pfm.variant.blackstone": "Blackstone", "block.pfm.variant.dark_concrete": "Dark Concrete", "block.pfm.variant.concrete": "Concrete", "block.pfm.variant.smooth_stone": "Smooth Stone",