Skip to content

Commit

Permalink
Merge branch 'architectury-1.17.1' into architectury-1.16.5
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java
#	common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java
#	common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java
  • Loading branch information
UnlikePaladin committed Oct 15, 2023
2 parents 47972dc + 9449ea7 commit fd4453f
Show file tree
Hide file tree
Showing 20 changed files with 253 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.unlikepaladin.pfm.runtime.PFMDataGen;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.client.texture.MissingSprite;
import net.minecraft.data.client.model.Texture;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
Expand All @@ -14,6 +15,7 @@
import net.minecraft.util.Pair;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.Nullable;

import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -45,38 +47,41 @@ public static BlockType getBlockType(Identifier identifier) {

public static VariantBase getVariant(Identifier identifier) {
VariantBase var = getExtraCounterType(identifier);
if (!identifier.getPath().contains("deepslate_tile")) {
if (var == null) {
var = getStoneType(identifier);
}
if ((var == StoneVariant.STONE && !identifier.getPath().contains("stone"))) {
if (var == null) {
var = getWoodType(identifier);
}
return var;
}

@Nullable
public static ExtraCounterVariant getExtraCounterType(Identifier identifier) {
for (ExtraCounterVariant variant:
ExtraCounterVariant.values()) {
if (identifier.getPath().contains(variant.getPath())) {
if (identifier.getPath().contains(variant.getPath()) && getBlockType(identifier) == BlockType.BLOCK) {
return variant;
}
}
return ExtraCounterVariant.DARK_CONCRETE;
return null;
}

@Nullable
public static StoneVariant getStoneType(Identifier identifier) {
for (StoneVariant variant:
StoneVariant.values()) {
if (identifier.getPath().contains(variant.getPath())) {
if (identifier.getPath().contains(variant.getPath()) && getBlockType(identifier) == BlockType.BLOCK) {
return variant;
}
}
return StoneVariant.STONE;
return null;
}
public static WoodVariant getWoodType(Identifier identifier){
WoodVariant selectedVariant = null;
for (WoodVariant woodVariant : WoodVariantRegistry.getVariants())
if (identifier.getPath().contains(woodVariant.identifier.getPath())) {
if (identifier.getPath().contains("dark") && !woodVariant.identifier.getPath().contains("dark"))
if (identifier.getPath().contains("dark") && !woodVariant.identifier.getPath().contains("dark") || (!identifier.getPath().contains(woodVariant.getNamespace()) && !woodVariant.isVanilla()))
continue;
selectedVariant = woodVariant;
}
Expand Down Expand Up @@ -169,7 +174,7 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo
}
else {
PFMDataGen.LOGGER.warn("Couldn't find texture for, {}", block);
id = Texture.getId(Blocks.BEDROCK);
id = MissingSprite.getMissingSpriteId();
}
blockToTextureMap.put(pair, id);
return id;
Expand All @@ -179,15 +184,34 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo
public static Identifier getPlankId(Block block) {
Identifier identifier = Registry.BLOCK.getId(block);
String namespace = identifier.getNamespace();
String path = identifier.getPath();
String path = identifier.getPath().replace("luphie_", "");
if (path.contains("planks")) {
path = path.replace("_planks", "");
path = path.replace("_planks", "").replace("plank_", "");
Identifier id = new Identifier(namespace, "block/" + path +"/planks");
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id;

path = "planks_" + path;
Identifier id = new Identifier(namespace, "block/wood/" + path);
path = path.replace("mining", "mine").replace("sorting", "sort").replace("transformation", "trans").replace("dark", "darkwood");
id = new Identifier(namespace, "block/" + path);
path = path.replace("mining", "mine").replace("sorting", "sort").replace("transformation", "trans").replace("dark", "darkwood").replace("alpha_", "alpha_oak_").replace("flowering_pink", "flowerypink").replace("flowering_purple", "floweringpurple");
Identifier id2 = new Identifier(namespace, "block/wood/" + path);
Identifier id3 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "planks");
Identifier id4 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "_planks");
Identifier id5 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "plankstext");
Identifier id6 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "plankretext");

if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id;
else if (idExists(id2, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id2;
else if (idExists(id3, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id3;
else if (idExists(id4, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id4;
else if (idExists(id5, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id5;
else if (idExists(id6, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id6;
else
return new Identifier(namespace, "block/wood/" + path+ "_0");
}
Expand All @@ -198,9 +222,17 @@ public static Identifier getPlankId(Block block) {
public static Identifier getLogId(Block block, String postFix) {
Identifier identifier = Registry.BLOCK.getId(block);
String namespace = identifier.getNamespace();
String path = identifier.getPath();
if (path.contains("log")) {
path = path.replace("log", "bark");
String path = identifier.getPath().replace("luphie_", "");
if (namespace.contains("luphieclutteredmod") && path.contains("flowering_log")) {
path = path.replace("flowering_log", "flowering_yellow_log");
}
if (namespace.equals("byg") && path.contains("pedu"))
path = path.replace("pedu", "log");
if (path.contains("log") || path.contains("stem")) {
if (!path.contains("_log")) {
path = path.replace("log", "_log");
}
path = path.replace("stem", "log").replace("log", "bark");
path += postFix;
Identifier id = new Identifier(namespace, "block/" + path);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
Expand Down Expand Up @@ -234,6 +266,26 @@ public static Identifier getLogId(Block block, String postFix) {
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
String loc = identifier.getPath().contains("stripped") || identifier.getPath().contains("striped") ? "stripped_log" : "log";
path = path.replace("striped_", "").replace(postFix, "").replace("_log", "");
if (!identifier.getPath().contains("stripped") && namespace.equals("byg"))
System.out.println("paused");
id = new Identifier(namespace, "block/" + path+ "/" + loc + postFix);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "/" + loc.replace("log", "stem") + postFix);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "/" + loc);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "/" + loc.replace("log", "stem"));
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
} else if (path.contains("reed")) {
path = path.replace("nether_", "").replace("reed", "reeds");
Identifier id = new Identifier(namespace, "block/" + path);
Expand All @@ -250,6 +302,18 @@ public static Identifier getLogId(Block block, String postFix) {
return id;
}
}
if (path.contains("alpha_")) {
path = path.replace("alpha", "alpha_oak");
Identifier id = new Identifier(namespace, "block/" + path);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)){
return id;
}
path += postFix;
id = new Identifier(namespace, "block/" + path);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
}
return new Identifier(namespace, "block/" + path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public class UnbakedBasicTableModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic"));
}
for(StoneVariant variant : StoneVariant.values()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic"));
Expand All @@ -65,12 +64,11 @@ public class UnbakedBasicTableModel implements UnbakedModel {
String newPart = part.replaceAll("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : BASIC_MODEL_PARTS_BASE) {
String newPart = part.replaceAll("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : BASIC_MODEL_PARTS_BASE) {
String newPart = part.replaceAll("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){
for (String part : BASIC_MODEL_PARTS_BASE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ public UnbakedClassicNightstandModel(VariantBase<?> variant, List<String> modelP
for(WoodVariant variant : WoodVariantRegistry.getVariants()){

add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/" + variant.asString() + "_classic_nightstand"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){

add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/stripped_" + variant.asString() + "_classic_nightstand"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/stripped_" + variant.asString() + "_classic_nightstand"));
}
for(StoneVariant variant : StoneVariant.values()){

Expand All @@ -72,13 +70,11 @@ public UnbakedClassicNightstandModel(VariantBase<?> variant, List<String> modelP
String newPart = part.replace("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){

for (String part : NIGHTSTAND_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : NIGHTSTAND_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public class UnbakedClassicTableModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic"));
}
for(StoneVariant variant : StoneVariant.values()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic"));
Expand All @@ -54,12 +53,11 @@ public class UnbakedClassicTableModel implements UnbakedModel {
String newPart = part.replace("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : CLASSIC_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : CLASSIC_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ public class UnbakedDinnerTableModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/stripped_" + variant.asString() + "_dinner_table"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/stripped_" + variant.asString() + "_dinner_table"));
}
for(StoneVariant variant : StoneVariant.values()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table"));
Expand All @@ -51,12 +50,11 @@ public class UnbakedDinnerTableModel implements UnbakedModel {
String newPart = part.replace("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : DINNER_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : DINNER_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){
for (String part : DINNER_MODEL_PARTS_BASE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public class UnbakedKitchenCabinetModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/" + variant.asString() + "_kitchen_cabinet"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/stripped_" + variant.asString() + "_kitchen_cabinet"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/stripped_" + variant.asString() + "_kitchen_cabinet"));
}
for(StoneVariant variant : StoneVariant.values()){
if (variant.equals(StoneVariant.QUARTZ))
Expand All @@ -62,12 +61,11 @@ public class UnbakedKitchenCabinetModel implements UnbakedModel {
String newPart = part.replace("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : CABINET_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : CABINET_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){
if (variant.equals(StoneVariant.QUARTZ))
Expand Down
Loading

0 comments on commit fd4453f

Please sign in to comment.