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 8fec6a030..c7e4c8c71 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.TextureMap; 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 f3136e2cc..de75dde26 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 @@ -218,7 +218,7 @@ protected void drawMouseoverTooltip(MatrixStack matrices, int x, int y) { int itemCount = 0; Style style = Style.EMPTY.withColor(Formatting.GRAY); for (ItemStack stack1 : handler.getPlayerInventory().main) { - if (stack1.isItemEqual(item.getDefaultStack())) { + if (stack1.isOf(item)) { itemCount += stack1.getCount(); } } 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 0650eb125..2978cd167 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java +++ b/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java @@ -93,8 +93,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 c74e388df..200f630c5 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/PaladinFurnitureModBlocksItems.java @@ -27,7 +27,7 @@ public class PaladinFurnitureModBlocksItems { public static final FridgeBlock GRAY_FRIDGE = new FridgeBlock(AbstractBlock.Settings.copy(GRAY_FREEZER).nonOpaque(), () -> PaladinFurnitureModBlocksItems.GRAY_FREEZER); public static final FreezerBlock IRON_FREEZER = new IronFreezerBlock(AbstractBlock.Settings.of(Material.METAL).resistance(3.5f).strength(5.0f).sounds(BlockSoundGroup.METAL).mapColor(MapColor.IRON_GRAY), () -> PaladinFurnitureModBlocksItems.IRON_FRIDGE); public static final FridgeBlock IRON_FRIDGE = new IronFridgeBlock(AbstractBlock.Settings.copy(IRON_FREEZER).nonOpaque(), () -> PaladinFurnitureModBlocksItems.IRON_FREEZER); - public static final FridgeBlock XBOX_FRIDGE = new XboxFridgeBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).nonOpaque().mapColor(MapColor.BLACK), null); + public static final FridgeBlock XBOX_FRIDGE = new XboxFridgeBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).resistance(1200.0F).nonOpaque().mapColor(MapColor.BLACK), null); public static final StoveBlock WHITE_STOVE = new StoveBlock(AbstractBlock.Settings.copy(WHITE_FREEZER)); public static final KitchenRangeHoodBlock WHITE_OVEN_RANGEHOOD = new KitchenRangeHoodBlock(AbstractBlock.Settings.copy(WHITE_FREEZER).nonOpaque()); 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 9e9826ca4..a508ac4e5 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 @@ -233,7 +233,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)); @@ -252,7 +252,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/fabric/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/fabric/PFMCookingForBlockheadsImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/fabric/PFMCookingForBlockheadsImpl.java index 1055968dc..7752fc7f4 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/fabric/PFMCookingForBlockheadsImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/compat/cookingforblockheads/fabric/PFMCookingForBlockheadsImpl.java @@ -1,7 +1,9 @@ package com.unlikepaladin.pfm.compat.cookingforblockheads.fabric; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.compat.PFMClientModCompatibility; import com.unlikepaladin.pfm.compat.cookingforblockheads.PFMCookingForBlockheads; +import com.unlikepaladin.pfm.compat.cookingforblockheads.fabric.client.PFMCookingForBlockheadsClient; import com.unlikepaladin.pfm.registry.BlockEntities; import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry; import com.unlikepaladin.pfm.runtime.data.FurnitureRecipeJsonFactory; @@ -18,14 +20,23 @@ import net.minecraft.data.server.recipe.RecipeJsonProvider; import net.minecraft.util.Identifier; +import java.util.Optional; import java.util.function.Consumer; public class PFMCookingForBlockheadsImpl extends PFMCookingForBlockheads { + private PFMClientModCompatibility clientModCompatibility; @Override public void generateRecipes(Consumer exporter) { FurnitureRecipeJsonFactory.create(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK, 4).group("kitchen").criterion(PFMRecipeProvider.getCriterionNameFromOutput(PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK), PFMRecipeProvider.conditionsFromItem(ModItems.recipeBook)).input(ModItems.recipeBook).input(Blocks.WHITE_CONCRETE, 2).input(Blocks.GRAY_CONCRETE).offerTo(exporter, new Identifier("pfm", PFMCookingForBlockHeadsCompat.COOKING_TABLE_BLOCK.asItem().getTranslationKey().replace("block.pfm.", ""))); } + @Override + public Optional getClientModCompatiblity() { + if (clientModCompatibility == null) + clientModCompatibility = new PFMCookingForBlockheadsClient(this); + return Optional.of(clientModCompatibility); + } + @Override public String getModId() { return "cookingforblockheads"; 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 4c03dc595..a5676139a 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 @@ -57,28 +57,30 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos builder.with(VARIANT, variant); return builder.build(); } - + @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, @Nullable RenderLayer renderType) { List quads = new ArrayList<>(); - int onOffset = state.get(Properties.LIT) ? 1 : 0; - WoodVariant variant = extraData.get(VARIANT); - BitSet set = extraData.get(CONNECTIONS).connections; - if (set.get(0) && set.get(1)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData, renderType)); - } else if (set.get(0)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType)); - } else if (set.get(1)) - { - quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); - } - else { - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType)); + if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { + int onOffset = state.get(Properties.LIT) ? 1 : 0; + WoodVariant variant = extraData.get(VARIANT); + BitSet set = extraData.get(CONNECTIONS).connections; + if (set.get(0) && set.get(1)) { + quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData, renderType)); + } else if (set.get(0)) { + quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType)); + } else if (set.get(1)) + { + quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); + } + else { + quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType)); + quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData, renderType)); + } } return quads; } 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 76c40154d..1dd88ded0 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 @@ -59,7 +59,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof BasicTableBlock) { + if (state != null && state.getBlock() instanceof BasicTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(CONNECTIONS).connections; boolean north = set.get(0); boolean east = set.get(1); 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 acceeb526..fd950a243 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 @@ -37,37 +37,39 @@ public ForgeBedModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) { List quads = new ArrayList<>(); - BedPart part = state.get(BedBlock.PART); - BitSet data = extraData.get(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, renderType)); - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType)); - if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData, renderType)); - } - if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData, renderType)); - } - if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData, renderType)); - } - } else { - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType)); - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType)); - if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); - } - if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData, renderType)); - } - if (!right && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData, renderType)); - } - if (!left && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData, renderType)); + if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { + BedPart part = state.get(BedBlock.PART); + BitSet data = extraData.get(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, renderType)); + quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData, renderType)); + if (!right){ + quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData, renderType)); + } + if (!left){ + quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData, renderType)); + } + if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ + quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData, renderType)); + } + } else { + quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderType)); + quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData, renderType)); + if (!right){ + quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData, renderType)); + } + if (!left){ + quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData, renderType)); + } + if (!right && bunk){ + quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData, renderType)); + } + if (!left && bunk){ + quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData, renderType)); + } } } 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 8651121f3..742bcd560 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 @@ -32,18 +32,20 @@ public ForgeClassicNightstandModel(Sprite frame, ModelBakeSettings settings, Map @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) { List quads = new ArrayList<>(); - BitSet data = extraData.get(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, renderType)); - } else if (!left && right) { - quads.addAll(getBakedModels().get(modelParts.get(1+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); - } else if (left) { - quads.addAll(getBakedModels().get(modelParts.get(2+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(3+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); + if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { + BitSet data = extraData.get(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, renderType)); + } else if (!left && right) { + quads.addAll(getBakedModels().get(modelParts.get(1+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); + } else if (left) { + quads.addAll(getBakedModels().get(modelParts.get(2+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(3+openIndexOffset)).getQuads(state, side, rand, extraData, renderType)); + } } 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 dbf13b28d..90af4672f 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 @@ -51,7 +51,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof ClassicTableBlock) { + if (state != null && state.getBlock() instanceof ClassicTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(CONNECTIONS).connections; boolean north = set.get(0); boolean east = set.get(1); 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 4a17ef58d..8a00d7420 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 @@ -48,7 +48,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderType) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof DinnerTableBlock) { + if (state != null && state.getBlock() instanceof DinnerTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 79a81495a..c7699c7dd 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 ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - Boolean hasFridge = extraData.get(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, renderLayer)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + if (state != null) { + Boolean hasFridge = extraData.get(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, renderLayer)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } } 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 a3c52686a..5479dca99 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 @@ -33,24 +33,26 @@ public ForgeFridgeModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - BitSet data = extraData.get(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, renderLayer)); - } - else if (top && bottom) { - quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { + BitSet data = extraData.get(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, renderLayer)); + } + else if (top && bottom) { + quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else if (bottom) { + quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else if (top) { + quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else if (hasFreezer) { + quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } } 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 d143889b2..c41ac0041 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 @@ -33,21 +33,23 @@ public ForgeIronFridgeModel(Sprite frame, ModelBakeSettings settings, Map getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - BitSet data = extraData.get(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, renderLayer)); - } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); - } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + if (state != null && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { + BitSet data = extraData.get(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, renderLayer)); + } else if (bottom) { + quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else if (top) { + quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else if (hasFreezer) { + quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } else { + quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData, renderLayer)); + } } 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 7e0e592cd..7bb52dc1b 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 @@ -59,9 +59,10 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return builder.build(); } + @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { - if (state.getBlock() instanceof KitchenCabinetBlock) { + if (state != null && state.getBlock() instanceof KitchenCabinetBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 2b8d52489..02d0e8440 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 @@ -74,9 +74,10 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return builder.build(); } + @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { - if (state.getBlock() instanceof KitchenCounterBlock) { + if (state != null && state.getBlock() instanceof KitchenCounterBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 635a75b63..decad1cb7 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 @@ -31,7 +31,7 @@ public ForgeKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Ma @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof KitchenCounterOvenBlock) { + if (state != null && state.getBlock() instanceof KitchenCounterOvenBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet data = extraData.get(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 0379c8172..b3b630ae6 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 @@ -76,7 +76,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { - if (state.getBlock() instanceof KitchenDrawerBlock) { + if (state != null && state.getBlock() instanceof KitchenDrawerBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 d08f96043..0a801185d 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 @@ -72,7 +72,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { - if (state.getBlock() instanceof KitchenWallCounterBlock) { + if (state != null && state.getBlock() instanceof KitchenWallCounterBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 4d7a9eb51..8a3cb9779 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 @@ -72,7 +72,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { - if (state.getBlock() instanceof KitchenWallDrawerBlock) { + if (state != null && state.getBlock() instanceof KitchenWallDrawerBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 d54021c6b..3a2534bd6 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 @@ -47,7 +47,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof LogTableBlock) { + if (state != null && state.getBlock() instanceof LogTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 a5d475989..b11cd9703 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 @@ -37,7 +37,7 @@ public ForgeMirrorModel(Sprite frame, Sprite glassTex, Sprite reflectTex, ModelB @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData, renderLayer)); - if (state.getBlock() instanceof MirrorBlock) { + if (state != null && state.getBlock() instanceof MirrorBlock && extraData.get(DIRECTIONS) != null && extraData.get(DIRECTIONS).connections != null) { BitSet connections = extraData.get(DIRECTIONS).connections; if (!connections.get(0)) { quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData, renderLayer)); 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 0e960e328..ccb4bcf1d 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 @@ -48,7 +48,7 @@ public ModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData extraData, RenderLayer renderLayer) { List quads = new ArrayList<>(); - if (state.getBlock() instanceof ModernDinnerTableBlock) { + if (state != null && state.getBlock() instanceof ModernDinnerTableBlock && extraData.get(CONNECTIONS) != null && extraData.get(CONNECTIONS).connections != null) { BitSet set = extraData.get(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 aa02c09a6..60cbd0bf2 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 @@ -42,8 +42,6 @@ private PaladinFurnitureModClientForge() { @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { - NetworkRegistryForge.registerPackets(); - ColorRegistryForge.registerBlockRenderLayers(); event.enqueueWork(PaladinFurnitureModClientForge::registerScreens); ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.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 f6720d137..a96dc9eb5 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.getEntity()); - - //Sync Config - NetworkRegistryForge.PFM_CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(event::getEntity), new SyncConfigPacket(PaladinFurnitureMod.getPFMConfig().options)); } + //Sync Config + NetworkRegistryForge.PFM_CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(event::getEntity), new SyncConfigPacket(PaladinFurnitureMod.getPFMConfig().options)); } } } diff --git a/gradle.properties b/gradle.properties index 4da1afc2b..255e6441a 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.19 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=5.12.42