Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to 1.21.60 #592

Merged
merged 12 commits into from
Mar 2, 2025
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Unless otherwise specified, any version comparison below is the comparison of se
- (API) Introduced `WorldStorage#readEntities`, `WorldStorage#writeEntities` and their correspond sync methods. These methods are used
to read and write entities in a specified chunk area.
- (API) Introduced a variety of methods for sending toast, title, subtitle and actionbar text to player, and new command `/title` is added.
- Add support for bedrock 1.21.60.
- Add support for the new entity storage format used in 1.18.30+. Now entities in newer vanilla maps can be loaded correctly.
- Implemented reeds (also called sugar cane) and cactus.
- Implemented `UpdateSubChunkBlocksPacket` related logic, which will make client load large range block updates much quicker (e.g.
Expand All @@ -75,6 +76,7 @@ Unless otherwise specified, any version comparison below is the comparison of se
- (API) Changed the default value of `ServerSettings#GenericSettings#defaultPermission` to `PlayerPermission.MEMBER`.
- (API) `VoxelShape` have being refactored. Now it doesn't allow using `vacancy`, this change is required by physics engine to fix some bugs.
- (API) Renamed `BlockState#setProperty` and `BlockState#setProperties` to `BlockState#setPropertyValue` and `BlockState#setPropertyValues` to match the getter methods.
- (API) Refactored the creative item registry and related classes & methods, which allow plugin to customize item groups.
- Main thread will sleep a short time if gui is enabled when the server exits abnormally. This gives user time to see what goes wrong.
- Server won't crash if failed to load the descriptor of a plugin now. An error message will be print to the console instead.
- Server won't crash if failed to create world generator. Void world generator will be used instead.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.allaymc.api.block.property.enums;

import org.allaymc.api.annotation.MinecraftVersionSensitive;

/**
* Automatically generated by {@code org.allaymc.codegen.BlockPropertyTypeGen}
*/
@MinecraftVersionSensitive
public enum CreakingHeartState {
UPROOTED,

DORMANT,

AWAKE
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public interface BlockPropertyTypes {

BooleanPropertyType CRAFTING = BooleanPropertyType.of("crafting", false);

EnumPropertyType<CreakingHeartState> CREAKING_HEART_STATE = EnumPropertyType.of("creaking_heart_state", CreakingHeartState.class, CreakingHeartState.values()[0]);

BooleanPropertyType DEAD_BIT = BooleanPropertyType.of("dead_bit", false);

IntPropertyType DEPRECATED = IntPropertyType.of("deprecated", 0, 3, 0);
Expand Down Expand Up @@ -238,5 +240,5 @@ public interface BlockPropertyTypes {

IntPropertyType WEIRDO_DIRECTION = IntPropertyType.of("weirdo_direction", 0, 3, 0);

List<BlockPropertyType<?>> VALUES = List.of(ACTIVE, AGE_16, AGE_3, AGE_4, AGE_6, AGE_BIT, ATTACHED_BIT, ATTACHMENT, BAMBOO_LEAF_SIZE, BAMBOO_STALK_THICKNESS, BIG_DRIPLEAF_HEAD, BIG_DRIPLEAF_TILT, BITE_COUNTER, BLOOM, BOOKS_STORED, BREWING_STAND_SLOT_A_BIT, BREWING_STAND_SLOT_B_BIT, BREWING_STAND_SLOT_C_BIT, BRUSHED_PROGRESS, BUTTON_PRESSED_BIT, CAN_SUMMON, CANDLES, CAULDRON_LIQUID, CLUSTER_COUNT, COMPOSTER_FILL_LEVEL, CONDITIONAL_BIT, CORAL_DIRECTION, CORAL_FAN_DIRECTION, COVERED_BIT, CRACKED_STATE, CRAFTING, DEAD_BIT, DEPRECATED, DIRECTION_16, DIRECTION_4, DISARMED_BIT, DOOR_HINGE_BIT, DRAG_DOWN, DRIPSTONE_THICKNESS, END_PORTAL_EYE_BIT, EXPLODE_BIT, EXTINGUISHED, FACING_DIRECTION, FILL_LEVEL, GROUND_SIGN_DIRECTION, GROWING_PLANT_AGE, GROWTH, HANGING, HEAD_PIECE_BIT, HEIGHT, HONEY_LEVEL, HUGE_MUSHROOM_BITS, IN_WALL_BIT, INFINIBURN_BIT, ITEM_FRAME_MAP_BIT, ITEM_FRAME_PHOTO_BIT, KELP_AGE, LEVER_DIRECTION, LIQUID_DEPTH, LIT, MINECRAFT_BLOCK_FACE, MINECRAFT_CARDINAL_DIRECTION, MINECRAFT_FACING_DIRECTION, MINECRAFT_VERTICAL_HALF, MOISTURIZED_AMOUNT, MULTI_FACE_DIRECTION_BITS, NATURAL, OCCUPIED_BIT, OMINOUS, OPEN_BIT, ORIENTATION, OUTPUT_LIT_BIT, OUTPUT_SUBTRACT_BIT, PALE_MOSS_CARPET_SIDE_EAST, PALE_MOSS_CARPET_SIDE_NORTH, PALE_MOSS_CARPET_SIDE_SOUTH, PALE_MOSS_CARPET_SIDE_WEST, PERSISTENT_BIT, PILLAR_AXIS, PORTAL_AXIS, POWERED_BIT, PROPAGULE_STAGE, RAIL_DATA_BIT, RAIL_DIRECTION_10, RAIL_DIRECTION_6, REDSTONE_SIGNAL, REPEATER_DELAY, RESPAWN_ANCHOR_CHARGE, ROTATION, SCULK_SENSOR_PHASE, SEA_GRASS_TYPE, STABILITY, STABILITY_CHECK, STRUCTURE_BLOCK_TYPE, SUSPENDED_BIT, TIP, TOGGLE_BIT, TORCH_FACING_DIRECTION, TRIAL_SPAWNER_STATE, TRIGGERED_BIT, TURTLE_EGG_COUNT, TWISTING_VINES_AGE, UPDATE_BIT, UPPER_BLOCK_BIT, UPSIDE_DOWN_BIT, VAULT_STATE, VINE_DIRECTION_BITS, WALL_CONNECTION_TYPE_EAST, WALL_CONNECTION_TYPE_NORTH, WALL_CONNECTION_TYPE_SOUTH, WALL_CONNECTION_TYPE_WEST, WALL_POST_BIT, WEEPING_VINES_AGE, WEIRDO_DIRECTION);
List<BlockPropertyType<?>> VALUES = List.of(ACTIVE, AGE_16, AGE_3, AGE_4, AGE_6, AGE_BIT, ATTACHED_BIT, ATTACHMENT, BAMBOO_LEAF_SIZE, BAMBOO_STALK_THICKNESS, BIG_DRIPLEAF_HEAD, BIG_DRIPLEAF_TILT, BITE_COUNTER, BLOOM, BOOKS_STORED, BREWING_STAND_SLOT_A_BIT, BREWING_STAND_SLOT_B_BIT, BREWING_STAND_SLOT_C_BIT, BRUSHED_PROGRESS, BUTTON_PRESSED_BIT, CAN_SUMMON, CANDLES, CAULDRON_LIQUID, CLUSTER_COUNT, COMPOSTER_FILL_LEVEL, CONDITIONAL_BIT, CORAL_DIRECTION, CORAL_FAN_DIRECTION, COVERED_BIT, CRACKED_STATE, CRAFTING, CREAKING_HEART_STATE, DEAD_BIT, DEPRECATED, DIRECTION_16, DIRECTION_4, DISARMED_BIT, DOOR_HINGE_BIT, DRAG_DOWN, DRIPSTONE_THICKNESS, END_PORTAL_EYE_BIT, EXPLODE_BIT, EXTINGUISHED, FACING_DIRECTION, FILL_LEVEL, GROUND_SIGN_DIRECTION, GROWING_PLANT_AGE, GROWTH, HANGING, HEAD_PIECE_BIT, HEIGHT, HONEY_LEVEL, HUGE_MUSHROOM_BITS, IN_WALL_BIT, INFINIBURN_BIT, ITEM_FRAME_MAP_BIT, ITEM_FRAME_PHOTO_BIT, KELP_AGE, LEVER_DIRECTION, LIQUID_DEPTH, LIT, MINECRAFT_BLOCK_FACE, MINECRAFT_CARDINAL_DIRECTION, MINECRAFT_FACING_DIRECTION, MINECRAFT_VERTICAL_HALF, MOISTURIZED_AMOUNT, MULTI_FACE_DIRECTION_BITS, NATURAL, OCCUPIED_BIT, OMINOUS, OPEN_BIT, ORIENTATION, OUTPUT_LIT_BIT, OUTPUT_SUBTRACT_BIT, PALE_MOSS_CARPET_SIDE_EAST, PALE_MOSS_CARPET_SIDE_NORTH, PALE_MOSS_CARPET_SIDE_SOUTH, PALE_MOSS_CARPET_SIDE_WEST, PERSISTENT_BIT, PILLAR_AXIS, PORTAL_AXIS, POWERED_BIT, PROPAGULE_STAGE, RAIL_DATA_BIT, RAIL_DIRECTION_10, RAIL_DIRECTION_6, REDSTONE_SIGNAL, REPEATER_DELAY, RESPAWN_ANCHOR_CHARGE, ROTATION, SCULK_SENSOR_PHASE, SEA_GRASS_TYPE, STABILITY, STABILITY_CHECK, STRUCTURE_BLOCK_TYPE, SUSPENDED_BIT, TIP, TOGGLE_BIT, TORCH_FACING_DIRECTION, TRIAL_SPAWNER_STATE, TRIGGERED_BIT, TURTLE_EGG_COUNT, TWISTING_VINES_AGE, UPDATE_BIT, UPPER_BLOCK_BIT, UPSIDE_DOWN_BIT, VAULT_STATE, VINE_DIRECTION_BITS, WALL_CONNECTION_TYPE_EAST, WALL_CONNECTION_TYPE_NORTH, WALL_CONNECTION_TYPE_SOUTH, WALL_CONNECTION_TYPE_WEST, WALL_POST_BIT, WEEPING_VINES_AGE, WEIRDO_DIRECTION);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.allaymc.api.registry.Registries;
import org.allaymc.api.utils.HashUtils;
import org.allaymc.api.utils.Identifier;
import org.allaymc.updater.block.BlockStateUpdater_1_21_40;
import org.allaymc.updater.block.BlockStateUpdaters;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder;
Expand Down Expand Up @@ -43,7 +42,7 @@ public static BlockState fromNBT(NbtMap nbt) {
}

if (version < ProtocolInfo.BLOCK_STATE_VERSION_NUM) {
nbt = BlockStateUpdaters.updateBlockState(nbt, BlockStateUpdaters.LATEST_VERSION);
nbt = BlockStateUpdaters.updateBlockState(nbt, ProtocolInfo.BLOCK_STATE_UPDATER.getVersion());
}

// Make sure that tree map is used
Expand Down Expand Up @@ -135,7 +134,8 @@ public BlockState blockState() {
}

// Get block type
var updatedNbt = BlockStateUpdaters.updateBlockState(nbtBuilder.build(), BlockStateUpdater_1_21_40.INSTANCE.getVersion());
var updatedNbt = BlockStateUpdaters.updateBlockState(nbtBuilder.build(), ProtocolInfo.BLOCK_STATE_UPDATER.getVersion());

var blockType = Registries.BLOCKS.get(new Identifier(updatedNbt.getString("name")));
if (blockType == null) {
throw new IllegalArgumentException("Unknown block type " + updatedNbt.getString("name"));
Expand Down
8 changes: 8 additions & 0 deletions api/src/main/java/org/allaymc/api/client/data/Abilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ public final class Abilities {

public static final float DEFAULT_WALK_SPEED = 0.1f;
public static final float DEFAULT_FLY_SPEED = 0.05f;
public static final float DEFAULT_VERTICAL_FLY_SPEED = 1.0f;

private final Set<Ability> abilities = EnumSet.noneOf(Ability.class);

private final EntityPlayer player;

private float walkSpeed = DEFAULT_WALK_SPEED;
private float flySpeed = DEFAULT_FLY_SPEED;
private float verticalFlySpeed = DEFAULT_VERTICAL_FLY_SPEED;

private boolean dirty = false;

Expand Down Expand Up @@ -93,6 +95,11 @@ public void setFlySpeed(float flySpeed) {
dirty = true;
}

public void setVerticalFlySpeed(float verticalFlySpeed) {
this.verticalFlySpeed = verticalFlySpeed;
dirty = true;
}

public void setFlying(boolean flying) {
set(Ability.FLYING, flying);
}
Expand All @@ -110,6 +117,7 @@ public void sync() {
abilityLayer.getAbilityValues().add(Ability.FLY_SPEED);
abilityLayer.setWalkSpeed(this.walkSpeed);
abilityLayer.setFlySpeed(this.flySpeed);
abilityLayer.setVerticalFlySpeed(this.verticalFlySpeed);

updateAbilitiesPacket.getAbilityLayers().add(abilityLayer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@ default void setFlySpeed(float flySpeed) {
getAbilities().setFlySpeed(flySpeed);
}

/**
* Set the vertical fly speed of the player.
*
* @param verticalFlySpeed The vertical fly speed to set.
*/
default void setVerticalFlySpeed(float verticalFlySpeed) {
getAbilities().setVerticalFlySpeed(verticalFlySpeed);
}

/**
* Set whether the player is flying.
*
Expand Down
109 changes: 102 additions & 7 deletions api/src/main/java/org/allaymc/api/i18n/TrKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -1547,11 +1547,6 @@ public interface TrKeys {
*/
String M_AUTOSAVE_INFO_GENERAL = "minecraft:autosave.info.general";

/**
* When you see this icon, we are saving your game. Do not turn off your Nintendo Switch while this icon is on screen.
*/
String M_AUTOSAVE_INFO_NX = "minecraft:autosave.info.nx";

/**
* When you see this icon, we are saving your game. Do not turn off your Xbox while this icon is on screen.
*/
Expand Down Expand Up @@ -2617,6 +2612,11 @@ public interface TrKeys {
*/
String M_COMMANDS_AIMASSIST_SUCCESS = "minecraft:commands.aimassist.success";

/**
* Target player's camera type does not support aim assist: %s
*/
String M_COMMANDS_AIMASSIST_UNSUPPORTEDCAMERATYPE = "minecraft:commands.aimassist.unsupportedCameraType";

/**
* Could not add %1#s to the allowlist
*/
Expand Down Expand Up @@ -4037,6 +4037,11 @@ public interface TrKeys {
*/
String M_COMMANDS_GENERIC_VERSION_MISSING = "minecraft:commands.generic.version.missing";

/**
* Active camera has to be a free camera to target an entity
*/
String M_COMMANDS_GENERIC_WRONGTARGETCAMERA = "minecraft:commands.generic.wrongTargetCamera";

/**
* Gets pixels for a specific chunk.
*/
Expand Down Expand Up @@ -4127,6 +4132,11 @@ public interface TrKeys {
*/
String M_COMMANDS_GLOBALPAUSE_DESCRIPTION = "minecraft:commands.globalpause.description";

/**
* Invalid conditions for setting pause state
*/
String M_COMMANDS_GLOBALPAUSE_ERROR = "minecraft:commands.globalpause.error";

/**
* Set or got pause state
*/
Expand Down Expand Up @@ -4738,12 +4748,12 @@ public interface TrKeys {
String M_COMMANDS_PERMISSIONS_SET_SUCCESS = "minecraft:commands.permissions.set.success";

/**
* Jigsaw structure generation failed. Not all chunks are loaded.
* Feature placement failed. Not all chunks are loaded.
*/
String M_COMMANDS_PLACE_CHUNKNOTLOADED_ERROR = "minecraft:commands.place.chunknotloaded.error";

/**
* Places a jigsaw structure in the world.
* Places a jigsaw structure, feature, or feature rule in the world.
*/
String M_COMMANDS_PLACE_DESCRIPTION = "minecraft:commands.place.description";

Expand All @@ -4757,6 +4767,21 @@ public interface TrKeys {
*/
String M_COMMANDS_PLACE_GENERATION_ERROR = "minecraft:commands.place.generation.error";

/**
* Invalid feature name.
*/
String M_COMMANDS_PLACE_INVALIDFEATURE_ERROR = "minecraft:commands.place.invalidfeature.error";

/**
* Invalid feature rule name.
*/
String M_COMMANDS_PLACE_INVALIDFEATURERULE_ERROR = "minecraft:commands.place.invalidfeaturerule.error";

/**
* Feature could not be placed at this location.
*/
String M_COMMANDS_PLACE_INVALIDPOSITION_ERROR = "minecraft:commands.place.invalidposition.error";

/**
* Invalid structure name.
*/
Expand Down Expand Up @@ -6717,6 +6742,11 @@ public interface TrKeys {
*/
String M_COMMANDS_WSSERVER_REQUEST_FAILED = "minecraft:commands.wsserver.request.failed";

/**
* Websocket server request rejected, go to Settings to enable.
*/
String M_COMMANDS_WSSERVER_REQUEST_FAILED_DISABLED = "minecraft:commands.wsserver.request.failed.disabled";

/**
* Connection established to server: %1#s
*/
Expand Down Expand Up @@ -7262,6 +7292,16 @@ public interface TrKeys {
*/
String M_DATE_FORMATTEDSPECIFIC_YESTERDAY = "minecraft:date.formattedSpecific.yesterday";

/**
* %1#s:%2#sam
*/
String M_DATE_FORMATTEDTIMEAM = "minecraft:date.formattedTimeAM";

/**
* %1#s:%2#spm
*/
String M_DATE_FORMATTEDTIMEPM = "minecraft:date.formattedTimePm";

/**
* %d %s %d
*/
Expand Down Expand Up @@ -8552,6 +8592,11 @@ public interface TrKeys {
*/
String M_DR_CATEGORIES_CAPES = "minecraft:dr.categories.capes";

/**
* Emotes
*/
String M_DR_CATEGORIES_EMOTES = "minecraft:dr.categories.emotes";

/**
* Eyes
*/
Expand Down Expand Up @@ -9447,6 +9492,11 @@ public interface TrKeys {
*/
String M_DR_HEADER_PREVIEWAPPEARANCE = "minecraft:dr.header.previewAppearance";

/**
* Dressing Room Search
*/
String M_DR_HEADER_SEARCH_HOME = "minecraft:dr.header.search.home";

/**
* Iris
*/
Expand Down Expand Up @@ -20377,6 +20427,31 @@ public interface TrKeys {
*/
String M_PATCHNOTES_UNLOCK = "minecraft:patchNotes.unlock";

/**
* Play
*/
String M_PAUSENOTIFICATION_PLAYBUTTON = "minecraft:pauseNotification.playButton";

/**
* Watch out, game is no longer paused!
*/
String M_PAUSENOTIFICATION_SUBTITLE_GAMEUNPAUSED = "minecraft:pauseNotification.subtitle.gameUnpaused";

/**
* Multiple people joined your game!
*/
String M_PAUSENOTIFICATION_TITLE_MORETHANTWOPLAYERS = "minecraft:pauseNotification.title.moreThanTwoPlayers";

/**
* %s joined your game!
*/
String M_PAUSENOTIFICATION_TITLE_ONEPLAYER = "minecraft:pauseNotification.title.onePlayer";

/**
* %s and %s joined your game!
*/
String M_PAUSENOTIFICATION_TITLE_TWOPLAYERS = "minecraft:pauseNotification.title.twoPlayers";

/**
* Back to Game
*/
Expand Down Expand Up @@ -20422,6 +20497,11 @@ public interface TrKeys {
*/
String M_PAUSESCREEN_FEED = "minecraft:pauseScreen.feed";

/**
* Game is paused
*/
String M_PAUSESCREEN_GAMEISPAUSED = "minecraft:pauseScreen.gameIsPaused";

/**
* Game Menu
*/
Expand Down Expand Up @@ -20452,6 +20532,11 @@ public interface TrKeys {
*/
String M_PAUSESCREEN_OPTIONS = "minecraft:pauseScreen.options";

/**
* Players in %s
*/
String M_PAUSESCREEN_PLAYERSTITLE = "minecraft:pauseScreen.playersTitle";

/**
* Save & Quit
*/
Expand Down Expand Up @@ -21449,6 +21534,16 @@ public interface TrKeys {
*/
String M_TERMS_AND_CONDITIONS_VIEWTERMSANDCONDITIONS = "minecraft:terms_and_conditions.viewTermsAndConditions";

/**
* TAP
*/
String M_TEXTTOICON_TOUCH_ASSIGMENT_ATTACK = "minecraft:textToIcon.touch.assigment.attack";

/**
* LONG TAP
*/
String M_TEXTTOICON_TOUCH_ASSIGMENT_USE = "minecraft:textToIcon.touch.assigment.use";

/**
* Acacia Fence
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.allaymc.api.pdc.PersistentDataHolder;
import org.allaymc.api.world.Dimension;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.protocol.bedrock.data.inventory.CreativeItemData;
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Vector3ic;
Expand Down Expand Up @@ -182,19 +181,6 @@ default void increaseCount(int count) {
*/
ItemData toNetworkItemData();

/**
* Get the creative item data.
*
* @return The creative item data.
*/
default CreativeItemData toCreativeItemData() {
var netItem = toNetworkItemData();
return CreativeItemData.builder()
.item(netItem)
.netId(netItem.getNetId())
.build();
}

/**
* Check if the item has a stack network id.
*
Expand Down
Loading