diff --git a/build.gradle.kts b/build.gradle.kts index b58ecc6..98ec125 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { id("signing") } -version = "1.20.30-SNAPSHOT" +version = "1.20.40-SNAPSHOT" group = "org.cloudburstmc" description = "Updates Minecraft: Bedrock Edition block states to the latest revision" diff --git a/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdater_1_20_40.java b/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdater_1_20_40.java new file mode 100644 index 0000000..4cd1cdb --- /dev/null +++ b/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdater_1_20_40.java @@ -0,0 +1,29 @@ +package org.cloudburstmc.blockstateupdater; + +import org.cloudburstmc.blockstateupdater.util.OrderedUpdater; +import org.cloudburstmc.blockstateupdater.util.tagupdater.CompoundTagUpdaterContext; + +import static org.cloudburstmc.blockstateupdater.util.OrderedUpdater.*; + +public class BlockStateUpdater_1_20_40 implements BlockStateUpdater { + + public static final BlockStateUpdater INSTANCE = new BlockStateUpdater_1_20_40(); + + @Override + public void registerUpdaters(CompoundTagUpdaterContext ctx) { + this.addDirectionUpdater(ctx, "minecraft:chest", FACING_TO_CARDINAL); + this.addDirectionUpdater(ctx, "minecraft:ender_chest", FACING_TO_CARDINAL); + this.addDirectionUpdater(ctx, "minecraft:stonecutter_block", FACING_TO_CARDINAL); + this.addDirectionUpdater(ctx, "minecraft:trapped_chest", FACING_TO_CARDINAL); + } + + private void addDirectionUpdater(CompoundTagUpdaterContext ctx, String identifier, OrderedUpdater updater) { + ctx.addUpdater(1, 20, 40) + .match("name", identifier) + .visit("states") + .edit(updater.getOldProperty(), helper -> { + int value = (int) helper.getTag(); + helper.replaceWith(updater.getNewProperty(), updater.translate(value)); + }); + } +} diff --git a/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdaters.java b/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdaters.java index 38944fb..a6ce3e2 100644 --- a/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdaters.java +++ b/src/main/java/org/cloudburstmc/blockstateupdater/BlockStateUpdaters.java @@ -35,6 +35,7 @@ public class BlockStateUpdaters { updaters.add(BlockStateUpdater_1_20_0.INSTANCE); updaters.add(BlockStateUpdater_1_20_10.INSTANCE); updaters.add(BlockStateUpdater_1_20_30.INSTANCE); + updaters.add(BlockStateUpdater_1_20_40.INSTANCE); CompoundTagUpdaterContext context = new CompoundTagUpdaterContext(); updaters.forEach(updater -> updater.registerUpdaters(context));