Skip to content

Commit

Permalink
Merge branch 'architectury-1.18.2' into architectury-1.19.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java
#	forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java
  • Loading branch information
UnlikePaladin committed Nov 1, 2023
2 parents 71fa394 + a2751cf commit e805b67
Show file tree
Hide file tree
Showing 30 changed files with 216 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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.TextureMap;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
Expand Down Expand Up @@ -201,6 +200,8 @@ public static Identifier getPlankId(Block block) {
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");
Identifier id7 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "_planks0");
Identifier id8 = new Identifier(namespace, "block/" + path.replace("planks_", "") + "_planks1");

if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id;
Expand All @@ -214,6 +215,10 @@ else if (idExists(id5, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id5;
else if (idExists(id6, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id6;
else if (idExists(id7, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id7;
else if (idExists(id8, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES))
return id8;
else
return new Identifier(namespace, "block/wood/" + path+ "_0");
}
Expand Down Expand Up @@ -270,8 +275,7 @@ public static Identifier getLogId(Block block, String postFix) {
}
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;
Expand All @@ -280,6 +284,14 @@ public static Identifier getLogId(Block block, String postFix) {
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "/" + loc + "/" + postFix.replace("_", ""));
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "/" + loc.replace("log", "stem") + "/" + postFix.replace("_", ""));
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;
Expand All @@ -288,6 +300,22 @@ public static Identifier getLogId(Block block, String postFix) {
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/stripped_" + path+ "_log");
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/stripped_" + path+ "_stem");
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "_log_stripped");
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/" + path+ "_stem_stripped");
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 @@ -304,8 +332,8 @@ public static Identifier getLogId(Block block, String postFix) {
return id;
}
}
if (path.contains("alpha_")) {
path = path.replace("alpha", "alpha_oak");
if (path.contains("alpha_") && namespace.contains("regions")) {
path = !path.contains("alpha_oak") ? path.replace("alpha", "alpha_oak") : path;
Identifier id = new Identifier(namespace, "block/" + path);
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)){
return id;
Expand All @@ -315,6 +343,10 @@ public static Identifier getLogId(Block block, String postFix) {
if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) {
return id;
}
id = new Identifier(namespace, "block/alpha_oak_log" + postFix);
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 @@ -218,7 +218,7 @@ protected void drawMouseoverTooltip(MatrixStack matrices, int x, int y) {
int itemCount = 0;
Style style = Style.EMPTY.withColor(Formatting.GRAY);
for (ItemStack stack1 : handler.getPlayerInventory().main) {
if (stack1.isItemEqual(item.getDefaultStack())) {
if (stack1.isOf(item)) {
itemCount += stack1.getCount();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import java.util.Optional;

public class PFMImmersivePortals implements PFMModCompatibility {
private final PFMClientModCompatibility clientModCompatibility;
private PFMClientModCompatibility clientModCompatibility;
public PFMImmersivePortals(){
clientModCompatibility = new PFMImmersivePortalsClient(this);
}
public static final EntityType<PFMMirrorEntity> MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity");

Expand All @@ -39,6 +38,8 @@ public String getModId() {

@Override
public Optional<PFMClientModCompatibility> getClientModCompatiblity() {
if (clientModCompatibility == null)
clientModCompatibility = new PFMImmersivePortalsClient(this);
return Optional.of(clientModCompatibility);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ boolean craft() {
List<Ingredient> ingredients = furnitureRecipe.getIngredients();
for (Ingredient ingredient : ingredients) {
for (ItemStack stack : ingredient.getMatchingStacks()) {
if (playerInventory.indexOf(stack) != -1) {
int indexOfStack = playerInventory.indexOf(stack);
if (FurnitureRecipe.getSlotWithStackIgnoreNBT(playerInventory, stack) != -1) {
int indexOfStack = FurnitureRecipe.getSlotWithStackIgnoreNBT(playerInventory, stack);
if (playerInventory.getStack(indexOfStack).getCount() >= stack.getCount()) {
ItemStack stack1 = playerInventory.getStack(indexOfStack);
stack1.decrement(stack.getCount());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.unlikepaladin.pfm.recipes;

import com.google.gson.*;
import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.DataFixerUpper;
import com.mojang.serialization.JsonOps;
import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems;
import com.unlikepaladin.pfm.registry.RecipeTypes;
Expand All @@ -13,7 +11,6 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.NbtString;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.recipe.*;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -47,27 +44,30 @@ public DefaultedList<Ingredient> getIngredients() {
public boolean matches(PlayerInventory playerInventory, World world) {
List<Ingredient> ingredients = this.getIngredients();
BitSet hasIngredients = new BitSet(ingredients.size());
if (this.output.getItem().equals(PaladinFurnitureModBlocksItems.GLASS_MODERN_PENDANT.asItem())) {
System.out.println("wtf");
}
HashMap<Item, Integer> containedItems = new HashMap<>();
for (int i = 0; i < ingredients.size(); i++) {
Ingredient ingredient = ingredients.get(i);
for (ItemStack stack : ingredient.getMatchingStacks()) {
int itemCount = 0;
for (ItemStack stack1 : playerInventory.main) {
if (stack.isItemEqual(stack1)) {
if (stack.isOf(stack1.getItem())) {
itemCount += stack1.getCount();
}
}
if (itemCount == 0)
break;

if (playerInventory.indexOf(stack) != -1){
if (getSlotWithStackIgnoreNBT(playerInventory, stack) != -1){
if (!containedItems.containsKey(stack.getItem())) {
if (itemCount >= stack.getCount()) {
hasIngredients.set(i, true);
containedItems.put(stack.getItem(), 1);
}
} else {
if (itemCount > containedItems.get(stack.getItem())) {
if (itemCount >= (containedItems.get(stack.getItem()) + 1)) {
hasIngredients.set(i, true);
containedItems.put(stack.getItem(), containedItems.get(stack.getItem()) + 1);
}
Expand All @@ -85,8 +85,23 @@ public boolean matches(PlayerInventory playerInventory, World world) {
return matches;
}

public static int getSlotWithStackIgnoreNBT(PlayerInventory inventory, ItemStack stack) {
for(int i = 0; i < inventory.main.size(); ++i) {
if (!inventory.main.get(i).isEmpty() && stack.isOf(inventory.main.get(i).getItem())) {
return i;
}
}

return -1;
}

@Override
public ItemStack craft(PlayerInventory playerInventory) {
if (this.output.getNbt() != null && this.output.getNbt().isEmpty()) {
ItemStack stack = this.output.copy();
stack.setNbt(null);
return stack;
}
return this.output.copy();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PaladinFurnitureModBlocksItems {
public static final FridgeBlock GRAY_FRIDGE = new FridgeBlock(AbstractBlock.Settings.copy(GRAY_FREEZER).nonOpaque(), () -> PaladinFurnitureModBlocksItems.GRAY_FREEZER);
public static final FreezerBlock IRON_FREEZER = new IronFreezerBlock(AbstractBlock.Settings.of(Material.METAL).resistance(3.5f).strength(5.0f).sounds(BlockSoundGroup.METAL).mapColor(MapColor.IRON_GRAY), () -> PaladinFurnitureModBlocksItems.IRON_FRIDGE);
public static final FridgeBlock IRON_FRIDGE = new IronFridgeBlock(AbstractBlock.Settings.copy(IRON_FREEZER).nonOpaque(), () -> PaladinFurnitureModBlocksItems.IRON_FREEZER);
public static final FridgeBlock XBOX_FRIDGE = new XboxFridgeBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).nonOpaque().mapColor(MapColor.BLACK), null);
public static final FridgeBlock XBOX_FRIDGE = new XboxFridgeBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).resistance(1200.0F).nonOpaque().mapColor(MapColor.BLACK), null);

public static final StoveBlock WHITE_STOVE = new StoveBlock(AbstractBlock.Settings.copy(WHITE_FREEZER));
public static final KitchenRangeHoodBlock WHITE_OVEN_RANGEHOOD = new KitchenRangeHoodBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).nonOpaque());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void generateTranslationForBedMap(HashMap<VariantBase<?>, ? extends List<
variantBaseHashMap.forEach((variant, list) -> {
list.forEach(block1 -> {
Block block = (Block) block1;
if (variant instanceof WoodVariant && !variant.isVanilla()) {
if (variant instanceof WoodVariant) {
String translatedVariantName = getTranslatedVariantName(variant);
String strippedKey = block.getTranslationKey().contains("stripped") ? translate("block.type.stripped") : "";
String translatedFurnitureName = StringUtils.normalizeSpace(blockStringStringStringStringQuadFunc.apply(block, furnitureKey, strippedKey, translatedVariantName));
Expand All @@ -252,7 +252,7 @@ public void generateTranslationForBedMap(HashMap<VariantBase<?>, ? extends List<

public void generateTranslationForVariantBlockMap(Map<VariantBase<?>, ? extends Block> variantBaseHashMap, BufferedWriter writer, String furnitureKey, QuadFunc<Block, String, String, String, String> blockStringStringStringStringQuadFunc) {
variantBaseHashMap.forEach((variant, block) -> {
if (variant instanceof WoodVariant && !variant.isVanilla()) {
if (variant instanceof WoodVariant) {
String translatedVariantName = getTranslatedVariantName(variant);
String strippedKey = block.getTranslationKey().contains("stripped") ? translate("block.type.stripped") : "";
String translatedFurnitureName = StringUtils.normalizeSpace(blockStringStringStringStringQuadFunc.apply(block, furnitureKey, strippedKey, translatedVariantName));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.unlikepaladin.pfm.compat.cookingforblockheads.fabric;

import com.unlikepaladin.pfm.PaladinFurnitureMod;
import com.unlikepaladin.pfm.compat.PFMClientModCompatibility;
import com.unlikepaladin.pfm.compat.cookingforblockheads.PFMCookingForBlockheads;
import com.unlikepaladin.pfm.compat.cookingforblockheads.fabric.client.PFMCookingForBlockheadsClient;
import com.unlikepaladin.pfm.registry.BlockEntities;
import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry;
import com.unlikepaladin.pfm.runtime.data.FurnitureRecipeJsonFactory;
Expand All @@ -18,14 +20,23 @@
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.util.Identifier;

import java.util.Optional;
import java.util.function.Consumer;

public class PFMCookingForBlockheadsImpl extends PFMCookingForBlockheads {
private PFMClientModCompatibility clientModCompatibility;
@Override
public void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
FurnitureRecipeJsonFactory.create(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK, 4).group("kitchen").criterion(PFMRecipeProvider.getCriterionNameFromOutput(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK), PFMRecipeProvider.conditionsFromItem(ModItems.recipeBook)).input(ModItems.recipeBook).input(Blocks.WHITE_CONCRETE, 2).input(Blocks.GRAY_CONCRETE).offerTo(exporter, new Identifier("pfm", PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK.asItem().getTranslationKey().replace("block.pfm.", "")));
}

@Override
public Optional<PFMClientModCompatibility> getClientModCompatiblity() {
if (clientModCompatibility == null)
clientModCompatibility = new PFMCookingForBlockheadsClient(this);
return Optional.of(clientModCompatibility);
}

@Override
public String getModId() {
return "cookingforblockheads";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,30 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos
builder.with(VARIANT, variant);
return builder.build();
}

@NotNull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, @Nullable RenderLayer renderType) {
List<BakedQuad> quads = new ArrayList<>();
int onOffset = state.get(Properties.LIT) ? 1 : 0;
WoodVariant variant = extraData.get(VARIANT);
BitSet set = extraData.get(CONNECTIONS).connections;
if (set.get(0) && set.get(1)) {
quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData, renderType));
} else if (set.get(0)) {
quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType));
} else if (set.get(1))
{
quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType));
}
else {
quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType));
if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) {
int onOffset = state.get(Properties.LIT) ? 1 : 0;
WoodVariant variant = extraData.get(VARIANT);
BitSet set = extraData.get(CONNECTIONS).connections;
if (set.get(0) && set.get(1)) {
quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData, renderType));
} else if (set.get(0)) {
quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType));
} else if (set.get(1))
{
quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType));
}
else {
quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType));
quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType));
}
}
return quads;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) {
List<BakedQuad> quads = new ArrayList<>();
if (state.getBlock() instanceof BasicTableBlock) {
if (state != null && state.getBlock() instanceof BasicTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) {
BitSet set = extraData.get(CONNECTIONS).connections;
boolean north = set.get(0);
boolean east = set.get(1);
Expand Down
Loading

0 comments on commit e805b67

Please sign in to comment.