From 05b045ccc1adaae75f0d442bd518d964814852ae Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 30 Oct 2023 21:25:36 -0600 Subject: [PATCH 01/11] Enable Automatic translations for all furniture --- .../com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 9b145598f..c26c72b34 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 @@ -230,7 +230,7 @@ public void generateTranslationForBedMap(HashMap, ? 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)); @@ -249,7 +249,7 @@ public void generateTranslationForBedMap(HashMap, ? extends List< public void generateTranslationForVariantBlockMap(Map, ? extends Block> variantBaseHashMap, BufferedWriter writer, String furnitureKey, QuadFunc 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)); From 6ca59f7d864a2e0f9ea33c56764e6a860d619b6a Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:33:57 -0600 Subject: [PATCH 02/11] Fixed an issue that prevented items with nbt from being valid furniture crafting ingredients, crafted furniture pieces now stack properly with items from the Creative Menu --- .../pfm/client/screens/WorkbenchScreen.java | 2 +- .../pfm/menus/WorkbenchScreenHandler.java | 4 +-- .../pfm/recipes/FurnitureRecipe.java | 27 ++++++++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/WorkbenchScreen.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/WorkbenchScreen.java index 3f527d9e9..fea29c3cb 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/screens/WorkbenchScreen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/WorkbenchScreen.java @@ -220,7 +220,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(); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java b/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java index 9068b5cb3..44f149294 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java +++ b/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java @@ -92,8 +92,8 @@ boolean craft() { List 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()); diff --git a/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java b/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java index afc8e1dfd..353b19fc3 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java +++ b/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java @@ -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; @@ -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; @@ -47,27 +44,30 @@ public DefaultedList getIngredients() { public boolean matches(PlayerInventory playerInventory, World world) { List ingredients = this.getIngredients(); BitSet hasIngredients = new BitSet(ingredients.size()); + if (this.output.getItem().equals(PaladinFurnitureModBlocksItems.GLASS_MODERN_PENDANT.asItem())) { + System.out.println("wtf"); + } HashMap 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); } @@ -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(); } From d00a7e20c413e5e530c854352b74e80c11ec2bda Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:10:29 -0600 Subject: [PATCH 03/11] Fix potential issues with Cooking For Blockheads --- .../forge/PFMCookingForBlockheadsImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java index 583b0c69c..5eaa821ad 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java @@ -13,6 +13,7 @@ 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 { @@ -40,4 +41,9 @@ public void registerBlocks() { public static PFMCookingForBlockheads getInstance() { return new PFMCookingForBlockheadsImpl(); } + + @Override + public Optional getClientModCompatiblity() { + return Optional.of(clientModCompatibility); + } } From 722837bb02672ed68b762d904c3b19b1b84aff40 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:44:35 -0600 Subject: [PATCH 04/11] Fix Lets Do beachparty wood compatibility --- .../pfm/blocks/models/ModelHelper.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 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 3b6ec5505..eeb733d05 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 @@ -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.model.Texture; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; @@ -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; @@ -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"); } @@ -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; @@ -288,6 +292,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); From 6ac8b99f4c2a1c2cd026150c761994dc6ca26ba4 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:47:42 -0600 Subject: [PATCH 05/11] Made the Xbox Series X Fridge blastproof lol --- .../pfm/registry/PaladinFurnitureModBlocksItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java b/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java index 5c06cdbab..9fdb007ec 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java @@ -29,7 +29,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()); From 74326b25f60294b5d9e66516a799f1eed981fb99 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:02:12 -0600 Subject: [PATCH 06/11] Fix potential issues with models on Forge --- .../basicLamp/forge/ForgeBasicLampModel.java | 36 ++++++----- .../forge/ForgeBasicTableModel.java | 2 +- .../models/bed/forge/ForgeBedModel.java | 64 ++++++++++--------- .../forge/ForgeClassicNightstandModel.java | 26 ++++---- .../forge/ForgeClassicTableModel.java | 2 +- .../forge/ForgeDinnerTableModel.java | 2 +- .../fridge/forge/ForgeFreezerModel.java | 14 ++-- .../models/fridge/forge/ForgeFridgeModel.java | 38 +++++------ .../fridge/forge/ForgeIronFridgeModel.java | 32 +++++----- .../forge/ForgeKitchenCabinetModel.java | 3 +- .../forge/ForgeKitchenCounterModel.java | 3 +- .../forge/ForgeKitchenCounterOvenModel.java | 2 +- .../forge/ForgeKitchenDrawerModel.java | 2 +- .../forge/ForgeKitchenWallCounterModel.java | 2 +- .../forge/ForgeKitchenWallDrawerModel.java | 2 +- .../logTable/forge/ForgeLogTableModel.java | 2 +- .../models/mirror/forge/ForgeMirrorModel.java | 2 +- .../forge/ForgeModernDinnerTableModel.java | 2 +- 18 files changed, 125 insertions(+), 111 deletions(-) diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java index 3e98522a3..92d0708c6 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java @@ -63,23 +63,25 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - int onOffset = state.get(Properties.LIT) ? 1 : 0; - WoodVariant variant = extraData.getData(VARIANT); - BitSet set = extraData.getData(CONNECTIONS).connections; - if (set.get(0) && set.get(1)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData)); - } else if (set.get(0)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData)); - } else if (set.get(1)) - { - quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); - } - else { - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); + if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + int onOffset = state.get(Properties.LIT) ? 1 : 0; + WoodVariant variant = extraData.getData(VARIANT); + BitSet set = extraData.getData(CONNECTIONS).connections; + if (set.get(0) && set.get(1)) { + quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + } else if (set.get(0)) { + quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + } else if (set.get(1)) + { + quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + } + else { + quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); + } } return quads; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java index 7fc410f7c..028f21299 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java @@ -58,7 +58,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof BasicTableBlock) { + if (state != null && state.getBlock() instanceof BasicTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; boolean north = set.get(0); boolean east = set.get(1); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java index 7128b71cd..4824d3167 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java @@ -36,37 +36,39 @@ public ForgeBedModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - BedPart part = state.get(BedBlock.PART); - BitSet data = extraData.getData(CONNECTIONS).connections; - boolean left = data.get(0); - boolean right = data.get(1); - boolean bunk = data.get(2); - if (part == BedPart.HEAD) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); - if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); - } - if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); - } - if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData)); - } - } else { - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); - if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); - } - if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); - } - if (!right && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); - } - if (!left && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData)); + if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + BedPart part = state.get(BedBlock.PART); + BitSet data = extraData.getData(CONNECTIONS).connections; + boolean left = data.get(0); + boolean right = data.get(1); + boolean bunk = data.get(2); + if (part == BedPart.HEAD) { + quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + if (!right){ + quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); + } + if (!left){ + quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + } + if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ + quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData)); + } + } else { + quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + if (!right){ + quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + } + if (!left){ + quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); + } + if (!right && bunk){ + quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); + } + if (!left && bunk){ + quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData)); + } } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java index 739fd24cb..cfdb607e0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java @@ -31,18 +31,20 @@ public ForgeClassicNightstandModel(Sprite frame, ModelBakeSettings settings, Map @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - BitSet data = extraData.getData(CONNECTIONS).connections; - boolean left = data.get(0); - boolean right = data.get(1); - int openIndexOffset = state.get(ClassicNightstandBlock.OPEN) ? 4 : 0; - if (left && right) { - quads.addAll(getBakedModels().get(modelParts.get(openIndexOffset)).getQuads(state, side, rand, extraData)); - } else if (!left && right) { - quads.addAll(getBakedModels().get(modelParts.get(1+openIndexOffset)).getQuads(state, side, rand, extraData)); - } else if (left) { - quads.addAll(getBakedModels().get(modelParts.get(2+openIndexOffset)).getQuads(state, side, rand, extraData)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(3+openIndexOffset)).getQuads(state, side, rand, extraData)); + if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + BitSet data = extraData.getData(CONNECTIONS).connections; + boolean left = data.get(0); + boolean right = data.get(1); + int openIndexOffset = state.get(ClassicNightstandBlock.OPEN) ? 4 : 0; + if (left && right) { + quads.addAll(getBakedModels().get(modelParts.get(openIndexOffset)).getQuads(state, side, rand, extraData)); + } else if (!left && right) { + quads.addAll(getBakedModels().get(modelParts.get(1+openIndexOffset)).getQuads(state, side, rand, extraData)); + } else if (left) { + quads.addAll(getBakedModels().get(modelParts.get(2+openIndexOffset)).getQuads(state, side, rand, extraData)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(3+openIndexOffset)).getQuads(state, side, rand, extraData)); + } } return quads; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java index 1d8d6c68d..a90fa60af 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java @@ -50,7 +50,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof ClassicTableBlock) { + if (state != null && state.getBlock() instanceof ClassicTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; boolean north = set.get(0); boolean east = set.get(1); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java index 79fa86c15..b89a792a5 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java @@ -47,7 +47,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof DinnerTableBlock) { + if (state != null && state.getBlock() instanceof DinnerTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java index 37c0b6653..7f83086c0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java @@ -34,12 +34,14 @@ public ForgeFreezerModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - Boolean hasFridge = extraData.getData(HAS_FRIDGE_PROPERTY); - int openOffset = state.get(FreezerBlock.OPEN) ? 2 : 0; - if (Boolean.TRUE.equals(hasFridge)) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + if (state != null) { + Boolean hasFridge = extraData.getData(HAS_FRIDGE_PROPERTY); + int openOffset = state.get(FreezerBlock.OPEN) ? 2 : 0; + if (Boolean.TRUE.equals(hasFridge)) { + quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + } } return quads; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java index d6c4ad7bb..7e79556c6 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java @@ -32,24 +32,26 @@ public ForgeFridgeModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - BitSet data = extraData.getData(CONNECTIONS).connections; - boolean bottom = data.get(0); - boolean top = data.get(1); - boolean hasFreezer = data.get(2); - int openOffset = state.get(FridgeBlock.OPEN) ? 6 : 0; - if (top && hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(5+openOffset)).getQuads(state, side, rand, extraData)); - } - else if (top && bottom) { - quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); - } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); - } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); - } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + BitSet data = extraData.getData(CONNECTIONS).connections; + boolean bottom = data.get(0); + boolean top = data.get(1); + boolean hasFreezer = data.get(2); + int openOffset = state.get(FridgeBlock.OPEN) ? 6 : 0; + if (top && hasFreezer) { + quads.addAll(getBakedModels().get(modelParts.get(5+openOffset)).getQuads(state, side, rand, extraData)); + } + else if (top && bottom) { + quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); + } else if (bottom) { + quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); + } else if (top) { + quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + } else if (hasFreezer) { + quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + } } return quads; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java index 09bc9b24c..14ea564d1 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java @@ -32,21 +32,23 @@ public ForgeIronFridgeModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - BitSet data = extraData.getData(CONNECTIONS).connections; - boolean bottom = data.get(0); - boolean top = data.get(1); - boolean hasFreezer = data.get(2); - int openOffset = state.get(FridgeBlock.OPEN) ? 5 : 0; - if (top && bottom) { - quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); - } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); - } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); - } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + BitSet data = extraData.getData(CONNECTIONS).connections; + boolean bottom = data.get(0); + boolean top = data.get(1); + boolean hasFreezer = data.get(2); + int openOffset = state.get(FridgeBlock.OPEN) ? 5 : 0; + if (top && bottom) { + quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); + } else if (bottom) { + quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); + } else if (top) { + quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + } else if (hasFreezer) { + quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + } } return quads; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java index 6affae4ef..3b11cc1e5 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java @@ -58,9 +58,10 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return builder.build(); } + @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - if (state.getBlock() instanceof KitchenCabinetBlock) { + if (state != null && state.getBlock() instanceof KitchenCabinetBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; KitchenCabinetBlock block = (KitchenCabinetBlock) state.getBlock(); Direction direction = state.get(KitchenCabinetBlock.FACING); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java index 5378b9a3e..391ddc901 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java @@ -73,9 +73,10 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return builder.build(); } + @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - if (state.getBlock() instanceof KitchenCounterBlock) { + if (state != null && state.getBlock() instanceof KitchenCounterBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; Direction direction = state.get(KitchenCounterBlock.FACING); KitchenCounterBlock block = (KitchenCounterBlock) state.getBlock(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java index 3b6fe1caa..870caf57c 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java @@ -30,7 +30,7 @@ public ForgeKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Ma @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof KitchenCounterOvenBlock) { + if (state != null && state.getBlock() instanceof KitchenCounterOvenBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet data = extraData.getData(CONNECTIONS).connections; int openOffset = state.get(KitchenCounterOvenBlock.OPEN) ? 2 : 0; if (data.get(0) || data.get(1)) { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java index cf49c4190..27c9a51e2 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java @@ -75,7 +75,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - if (state.getBlock() instanceof KitchenDrawerBlock) { + if (state != null && state.getBlock() instanceof KitchenDrawerBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; Direction direction = state.get(KitchenDrawerBlock.FACING); KitchenDrawerBlock block = (KitchenDrawerBlock) state.getBlock(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java index fcd5c6bad..2a9bb4f12 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java @@ -71,7 +71,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - if (state.getBlock() instanceof KitchenWallCounterBlock) { + if (state != null && state.getBlock() instanceof KitchenWallCounterBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; Direction direction = state.get(KitchenWallCounterBlock.FACING); KitchenWallCounterBlock block = (KitchenWallCounterBlock) state.getBlock(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java index 32ad04c56..48c491986 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java @@ -71,7 +71,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - if (state.getBlock() instanceof KitchenWallDrawerBlock) { + if (state != null && state.getBlock() instanceof KitchenWallDrawerBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; Direction direction = state.get(KitchenWallDrawerBlock.FACING); KitchenWallDrawerBlock block = (KitchenWallDrawerBlock) state.getBlock(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java index 90728df75..26e010c45 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java @@ -46,7 +46,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof LogTableBlock) { + if (state != null && state.getBlock() instanceof LogTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java index 43977f23f..fa84db97a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java @@ -36,7 +36,7 @@ public ForgeMirrorModel(Sprite frame, Sprite glassTex, Sprite reflectTex, ModelB @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); - if (state.getBlock() instanceof MirrorBlock) { + if (state != null && state.getBlock() instanceof MirrorBlock && extraData.getData(DIRECTIONS) != null && extraData.getData(DIRECTIONS).connections != null) { BitSet connections = extraData.getData(DIRECTIONS).connections; if (!connections.get(0)) { quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java index 576a8e2e4..880bba45e 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java @@ -47,7 +47,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof ModernDinnerTableBlock) { + if (state != null && state.getBlock() instanceof ModernDinnerTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); From a285a9e3f6d609e118f698b574b3422cd2922c85 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:25:36 -0600 Subject: [PATCH 07/11] Fix Promenade wood types --- .../com/unlikepaladin/pfm/blocks/models/ModelHelper.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 eeb733d05..ebd0870df 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 @@ -284,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; From 92c30aa8050e56e0874eecd09bc2c2c693bddb24 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:47:41 -0600 Subject: [PATCH 08/11] Fix minor issue with regions unexplored --- .../com/unlikepaladin/pfm/blocks/models/ModelHelper.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 ebd0870df..e37f52d2b 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 @@ -332,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; @@ -343,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); } From ebc1c95c689e35018456b0e36c172eea475f2b28 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:11:47 -0600 Subject: [PATCH 09/11] Fix config only being synced on Forge is the book was enabled. And packets being registered twice. --- .../pfm/client/forge/PaladinFurnitureModClientForge.java | 2 -- .../pfm/registry/forge/NetworkRegistryForge.java | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java index cbd2f76c7..4f5d55d1a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java @@ -43,8 +43,6 @@ private PaladinFurnitureModClientForge() { @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { - NetworkRegistryForge.registerPackets(); - ColorRegistryForge.registerBlockRenderLayers(); event.enqueueWork(PaladinFurnitureModClientForge::registerScreens); ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class, diff --git a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java index 104308e1e..63cc281e7 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java @@ -40,10 +40,9 @@ public static void onServerJoin(PlayerEvent.PlayerLoggedInEvent event) { if (PaladinFurnitureMod.getPFMConfig().shouldGiveGuideBook()) { //Give book PFMCriteria.GUIDE_BOOK_CRITERION.trigger((ServerPlayerEntity) event.getPlayer()); - - //Sync Config - NetworkRegistryForge.PFM_CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(event::getPlayer), new SyncConfigPacket(PaladinFurnitureMod.getPFMConfig().options)); } + //Sync Config + NetworkRegistryForge.PFM_CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(event::getPlayer), new SyncConfigPacket(PaladinFurnitureMod.getPFMConfig().options)); } } } From ed10ae76fc24de571e4352388423a04256a2e238 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:15:33 -0600 Subject: [PATCH 10/11] Fix possible crashes with Immersive Portals and CookingWithBlockHeads --- .../pfm/compat/imm_ptl/PFMImmersivePortals.java | 5 +++-- .../forge/PFMCookingForBlockheadsImpl.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java index 518daccd9..4e68e3416 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java +++ b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMImmersivePortals.java @@ -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 MIRROR = EntityType.Builder.create(PFMMirrorEntity::new, SpawnGroup.MISC).setDimensions(0.0F, 0.0F).makeFireImmune().disableSummon().build("mirror_entity"); @@ -39,6 +38,8 @@ public String getModId() { @Override public Optional getClientModCompatiblity() { + if (clientModCompatibility == null) + clientModCompatibility = new PFMImmersivePortalsClient(this); return Optional.of(clientModCompatibility); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java index 5eaa821ad..1b168b1ed 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java @@ -17,10 +17,9 @@ import java.util.function.Consumer; public class PFMCookingForBlockheadsImpl extends PFMCookingForBlockheads { - private final PFMClientModCompatibility clientModCompatibility; + private PFMClientModCompatibility clientModCompatibility; public PFMCookingForBlockheadsImpl() { - clientModCompatibility = new PFMCookingForBlockheadsClient(this); } @Override @@ -44,6 +43,8 @@ public static PFMCookingForBlockheads getInstance() { @Override public Optional getClientModCompatiblity() { + if (clientModCompatibility == null) + clientModCompatibility = new PFMCookingForBlockheadsClient(this); return Optional.of(clientModCompatibility); } } From 8c231b662d1ad230259515fb9ba2e0bb2fa2f85e Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:16:09 -0600 Subject: [PATCH 11/11] Bump mod version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9955a805a..2ed9da0b5 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.17.1 enabled_platforms=fabric,forge archives_base_name=paladin-furniture-mod -mod_version=1.2.0-rc4 +mod_version=1.2.0-rc5 maven_group=com.unlikepaladin architectury_version=2.10.12