Skip to content

Commit

Permalink
Add MCBE 1.20.40 updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Oct 16, 2023
1 parent 48146de commit 66a6be1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
@@ -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));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 66a6be1

Please sign in to comment.