Skip to content

Commit

Permalink
Add MCBE 1.20.80 updaters
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Apr 11, 2024
1 parent 5a24a49 commit 27bebd5
Show file tree
Hide file tree
Showing 3 changed files with 84 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.70-SNAPSHOT"
version = "1.20.80-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,82 @@
package org.cloudburstmc.blockstateupdater;

import org.cloudburstmc.blockstateupdater.util.tagupdater.CompoundTagUpdaterContext;

import java.util.function.Function;

public class BlockStateUpdater_1_20_80 implements BlockStateUpdater {

public static final BlockStateUpdater INSTANCE = new BlockStateUpdater_1_20_80();

@Override
public void registerUpdaters(CompoundTagUpdaterContext ctx) {
this.addTypeUpdater(ctx, "minecraft:sapling", "sapling_type", type -> "minecraft:" + type + "_sapling");
this.addTypeUpdater(ctx, "minecraft:red_flower", "flower_type", type -> {
switch (type) {
case "tulip_orange":
return "minecraft:orange_tulip";
case "tulip_pink":
return "minecraft:pink_tulip";
case "tulip_white":
return "minecraft:white_tulip";
case "oxeye":
return "minecraft:oxeye_daisy";
case "orchid":
return "minecraft:blue_orchid";
case "houstonia":
return "minecraft:azure_bluet";
case "tulip_red":
default:
return "minecraft:red_tulip";
}
});

this.addTypeUpdater(ctx, "minecraft:coral_fan", "coral_color", type -> {
switch (type) {
case "blue":
return "minecraft:tube_coral_fan";
case "pink":
return "minecraft:brain_coral_fan";
case "purple":
return "minecraft:bubble_coral_fan";
case "yellow":
return "minecraft:horn_coral_fan";
case "red":
default:
return "minecraft:fire_coral_fan";
}
});

this.addTypeUpdater(ctx, "minecraft:coral_fan_dead", "coral_color", type -> {
switch (type) {
case "blue":
return "minecraft:dead_tube_coral_fan";
case "pink":
return "minecraft:dead_brain_coral_fan";
case "purple":
return "minecraft:dead_bubble_coral_fan";
case "yellow":
return "minecraft:dead_horn_coral_fan";
case "red":
default:
return "minecraft:dead_fire_coral_fan";
}
});


// This is not official updater, but they correctly removed sapling_type
ctx.addUpdater(1, 20, 80, false, false)
.match("name", "minecraft:bamboo_sapling")
.visit("states")
.remove("sapling_type");
}

private void addTypeUpdater(CompoundTagUpdaterContext context, String identifier, String typeState, Function<String, String> rename) {
context.addUpdater(1, 20, 80)
.match("name", identifier)
.visit("states")
.edit(typeState, helper -> helper.getRootTag().put("name", rename.apply((String) helper.getTag())))
.remove(typeState);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class BlockStateUpdaters {
updaters.add(BlockStateUpdater_1_20_50.INSTANCE);
updaters.add(BlockStateUpdater_1_20_60.INSTANCE);
updaters.add(BlockStateUpdater_1_20_70.INSTANCE);
updaters.add(BlockStateUpdater_1_20_80.INSTANCE);

CompoundTagUpdaterContext context = new CompoundTagUpdaterContext();
updaters.forEach(updater -> updater.registerUpdaters(context));
Expand Down

0 comments on commit 27bebd5

Please sign in to comment.