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..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 @@ -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; @@ -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; @@ -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); @@ -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; @@ -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); } 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/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/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(); } 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()); 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)); 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); 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 4f7eeb456..6e0fcbc64 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/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/forge/PFMCookingForBlockheadsImpl.java index 583b0c69c..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 @@ -13,13 +13,13 @@ 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 final PFMClientModCompatibility clientModCompatibility; + private PFMClientModCompatibility clientModCompatibility; public PFMCookingForBlockheadsImpl() { - clientModCompatibility = new PFMCookingForBlockheadsClient(this); } @Override @@ -40,4 +40,11 @@ public void registerBlocks() { public static PFMCookingForBlockheads getInstance() { return new PFMCookingForBlockheadsImpl(); } + + @Override + public Optional getClientModCompatiblity() { + if (clientModCompatibility == null) + clientModCompatibility = new PFMCookingForBlockheadsClient(this); + return Optional.of(clientModCompatibility); + } } 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 6418a8bef..e7d0c718c 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)); } } } diff --git a/gradle.properties b/gradle.properties index eacb53652..2fd5a6c2b 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.18.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=3.9.66