Skip to content

Commit

Permalink
Merge branch 'architectury-1.19.2' into architectury-1.19.3
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/VariantRegistryBase.java
#	common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java
#	common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java
  • Loading branch information
UnlikePaladin committed Oct 30, 2023
2 parents 7475e04 + 71fa394 commit 5bd3c3c
Show file tree
Hide file tree
Showing 32 changed files with 268 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.util.Pair;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -49,38 +50,41 @@ public static BlockType getBlockType(Identifier identifier) {

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

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ public class UnbakedBasicTableModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic"));
}
for(StoneVariant variant : StoneVariant.values()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic"));
Expand All @@ -62,12 +61,11 @@ public class UnbakedBasicTableModel implements UnbakedModel {
String newPart = part.replaceAll("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : BASIC_MODEL_PARTS_BASE) {
String newPart = part.replaceAll("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : BASIC_MODEL_PARTS_BASE) {
String newPart = part.replaceAll("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){
for (String part : BASIC_MODEL_PARTS_BASE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,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 @@ -69,13 +67,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 @@ -34,9 +34,8 @@ public class UnbakedClassicTableModel implements UnbakedModel {
{
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic"));
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic"));
if (variant.hasStripped())
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic"));
}
for(StoneVariant variant : StoneVariant.values()){
add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic"));
Expand All @@ -51,12 +50,11 @@ public class UnbakedClassicTableModel implements UnbakedModel {
String newPart = part.replace("template", variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(WoodVariant variant : WoodVariantRegistry.getVariants()){
for (String part : CLASSIC_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
if (variant.hasStripped())
for (String part : CLASSIC_MODEL_PARTS_BASE) {
String newPart = part.replace("template", "stripped_" + variant.asString());
add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart));
}
}
for(StoneVariant variant : StoneVariant.values()){

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

0 comments on commit 5bd3c3c

Please sign in to comment.