Skip to content

Commit

Permalink
Stone Furniture is now also dynamic and registry driven
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed May 20, 2024
1 parent 2fc84b2 commit d559335
Show file tree
Hide file tree
Showing 38 changed files with 326 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down
Loading

0 comments on commit d559335

Please sign in to comment.