From 42b57bdd61094ebdd5bdd6c5b8a5cbc46fa6b164 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 7 Aug 2024 10:39:18 +0200 Subject: [PATCH] Update framed blocks integration --- build.gradle | 2 +- gradle.properties | 4 ++-- .../FramedBlocksInSchematics.java | 24 ++++++++++++++----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index af4d6ce19..3bdf28498 100644 --- a/build.gradle +++ b/build.gradle @@ -204,7 +204,7 @@ dependencies { // implementation fg.deobf("curse.maven:druidcraft-340991:3101903") // implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25") - // runtimeOnly fg.deobf("curse.maven:framedblocks-441647:4567924") + // runtimeOnly fg.deobf("curse.maven:framedblocks-441647:4762544") // runtimeOnly fg.deobf("curse.maven:galosphere-631098:4398234") // runtimeOnly fg.deobf("curse.maven:elementary-ores-332609:3956498") // runtimeOnly fg.deobf("curse.maven:flib-661261:3956196") diff --git a/gradle.properties b/gradle.properties index 16ec7dafc..75b89dd1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ mod_version = 0.5.1.g artifact_minecraft_version = 1.19.2 minecraft_version = 1.19.2 -forge_version = 43.2.4 +forge_version = 43.2.14 # build dependency versions forgegradle_version = 5.1.74 @@ -25,7 +25,7 @@ registrate_version = MC1.19-1.1.5 flywheel_minecraft_version = 1.19.2 flywheel_version = 0.6.10-20 jei_minecraft_version = 1.19.2 -jei_version = 11.2.0.254 +jei_version = 11.6.0.1024 curios_minecraft_version = 1.19.2 curios_version = 5.1.4.1 diff --git a/src/main/java/com/simibubi/create/compat/framedblocks/FramedBlocksInSchematics.java b/src/main/java/com/simibubi/create/compat/framedblocks/FramedBlocksInSchematics.java index 100a07e7e..6490943cb 100644 --- a/src/main/java/com/simibubi/create/compat/framedblocks/FramedBlocksInSchematics.java +++ b/src/main/java/com/simibubi/create/compat/framedblocks/FramedBlocksInSchematics.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.schematics.requirement.ItemRequirement.ItemUs import com.simibubi.create.content.schematics.requirement.ItemRequirement.StackRequirement; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.BlockEntity; @@ -17,7 +18,7 @@ import net.minecraft.world.level.block.state.BlockState; public class FramedBlocksInSchematics { static final List KEYS_TO_RETAIN = - List.of("intangible", "glowing", "reinforced", "camo_stack", "camo_stack_two", "camo_state", "camo_state_two"); + List.of("intangible", "glowing", "reinforced", "camo", "camo_two"); public static CompoundTag prepareBlockEntityData(BlockState blockState, BlockEntity blockEntity) { CompoundTag data = null; @@ -32,6 +33,14 @@ public class FramedBlocksInSchematics { keysToRemove.add(key); for (String key : keysToRemove) data.remove(key); + + if (data.getCompound("camo") + .contains("fluid")) + data.remove("camo"); + + if (data.getCompound("camo_two") + .contains("fluid")) + data.remove("camo_two"); return data; } @@ -53,17 +62,20 @@ public class FramedBlocksInSchematics { list.add(new StackRequirement(new ItemStack(Mods.FRAMEDBLOCKS.getItem("framed_reinforcement")), ItemUseType.CONSUME)); - if (data.contains("camo_stack")) - addCamoStack(data.getCompound("camo_stack"), list); + if (data.contains("camo")) + addCamoStack(data.getCompound("camo"), list); - if (data.contains("camo_stack_two")) - addCamoStack(data.getCompound("camo_stack_two"), list); + if (data.contains("camo_two")) + addCamoStack(data.getCompound("camo_two"), list); return new ItemRequirement(list); } private static void addCamoStack(CompoundTag tag, List list) { - ItemStack itemStack = ItemStack.of(tag); + if (!tag.contains("state")) + return; + BlockState blockState = NbtUtils.readBlockState(tag.getCompound("state")); + ItemStack itemStack = new ItemStack(blockState.getBlock()); if (!itemStack.isEmpty()) list.add(new StackRequirement(itemStack, ItemUseType.CONSUME)); }