Skip to content

Commit

Permalink
Bedrock 1.21.60
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Jan 18, 2025
1 parent 1cb068a commit e9bcc8d
Show file tree
Hide file tree
Showing 19 changed files with 319 additions and 86 deletions.
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/GameVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public enum GameVersion {
V1_21_30(729, "1.21.30"),
V1_21_40(748, "1.21.40"),
V1_21_50(766, "1.21.50"),
V1_21_60(776, "1.21.60"),
;

private static GameVersion FEATURE_VERSION = GameVersion.V1_18_0;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ public boolean sleepOn(Vector3 pos) {

this.sleeping = pos.clone();

this.setDataProperty(new Vector3fEntityData(DATA_ENTER_BED_POSITION, asVector3f()));
this.recalculateBoundingBox();
this.setDataProperty(new IntPositionEntityData(DATA_PLAYER_BED_POSITION, (int) pos.x, (int) pos.y, (int) pos.z));
this.setPlayerFlag(DATA_PLAYER_FLAG_SLEEP, true);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/cn/nukkit/block/BlockNoteblock.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void emitSound() {

Instrument instrument = this.getInstrument();

this.level.addLevelSoundEvent(this, LevelSoundEventPacket.SOUND_NOTE, instrument.ordinal() << 8 | this.getStrength());
this.level.addLevelSoundEvent(this, LevelSoundEventPacket.SOUND_NOTE, -(instrument.ordinal() << 8 | this.getStrength()));

BlockEventPacket pk = new BlockEventPacket();
pk.x = this.getFloorX();
Expand Down Expand Up @@ -283,22 +283,22 @@ public enum Instrument {
DRUM(SoundEnum.NOTE_SNARE),
STICKS(SoundEnum.NOTE_HAT),
BASS(SoundEnum.NOTE_BASS),
GLOCKENSPIEL(SoundEnum.NOTE_BELL),
FLUTE(SoundEnum.NOTE_FLUTE),
CHIME(SoundEnum.NOTE_CHIME),
GLOCKENSPIEL(SoundEnum.NOTE_BELL),
GUITAR(SoundEnum.NOTE_GUITAR),
CHIME(SoundEnum.NOTE_CHIME),
XYLOPHONE(SoundEnum.NOTE_XYLOPHONE),
VIBRAPHONE(SoundEnum.NOTE_IRON_XYLOPHONE),
COW_BELL(SoundEnum.NOTE_COW_BELL),
DIDGERIDOO(SoundEnum.NOTE_DIDGERIDOO),
SQUARE_WAVE(SoundEnum.NOTE_BIT),
BANJO(SoundEnum.NOTE_BANJO),
ELECTRIC_PIANO(SoundEnum.NOTE_PLING),
SKELETON(SoundEnum.NOTE_SKELETON),
WITHER_SKELETON(SoundEnum.NOTE_WITHERSKELETON),
ZOMBIE(SoundEnum.NOTE_ZOMBIE),
SKELETON(SoundEnum.NOTE_SKELETON),
CREEPER(SoundEnum.NOTE_CREEPER),
ENDER_DRAGON(SoundEnum.NOTE_ENDERDRAGON),
WITHER_SKELETON(SoundEnum.NOTE_WITHERSKELETON),
PIGLIN(SoundEnum.NOTE_PIGLIN),
;

Expand Down
12 changes: 11 additions & 1 deletion src/main/java/cn/nukkit/entity/data/EntityDataID.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ public interface EntityDataID {
* @since 1.21.0
*/
int DATA_VISIBLE_MOB_EFFECTS = 137;
/**
* string.
* @since 1.21.60
*/
int DATA_FILTERED_NAME = 138;
/**
* vec3.
* @since 1.21.60
*/
int DATA_ENTER_BED_POSITION = 139;

int DATA_UNDEFINED = 138;
int DATA_UNDEFINED = 140;
}
3 changes: 2 additions & 1 deletion src/main/java/cn/nukkit/entity/item/EntityFishingHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public boolean onUpdate(int currentTick) {
this.motionZ = 0;

// this.addMovement(this.x, this.y + this.getBaseOffset(), this.z, this.yaw, this.pitch, this.yaw);
return false;
//return false;
} else if (!this.isCollided && this.hadCollision) {
this.hadCollision = false;
}
Expand Down Expand Up @@ -329,6 +329,7 @@ public boolean onUpdate(int currentTick) {
this.waitTimer = this.waitChance * 3;
}
}
hasUpdate = true;
}

return hasUpdate;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/cn/nukkit/item/RuntimeItemPaletteInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ class Entry {
@Nullable
public final Integer oldData;
public final boolean component;
public final int version;

public Entry(String name, int id, @Nullable Integer oldId, @Nullable Integer oldData) {
this(name, id, oldId, oldData, false);
}

public Entry(String name, int id, @Nullable Integer oldId, @Nullable Integer oldData, boolean component) {
this(name, id, oldId, oldData, component, 2);
}

public Entry(String name, int id, @Nullable Integer oldId, @Nullable Integer oldData, boolean component, int version) {
this.name = name;
this.id = id;
this.oldId = oldId;
this.oldData = oldData;
this.component = component;
this.version = version;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum StaticVersion {
V1_21_30(729, false),
V1_21_40(748, false),
V1_21_50(766, false),
V1_21_60(776, false),
;

private static final StaticVersion MINIMUM_AVAILABLE_VERSION = V1_18_30;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/cn/nukkit/level/ParticleEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public enum ParticleEffect {
EXPLOSION_LABTABLE_FIRE("minecraft:misc_fire_vapor_particle"),
EXPLOSION_LEVEL("minecraft:explosion_particle"),
EXPLOSION_MANUAL("minecraft:explosion_manual"),
EYEBLOSSOM_CLOSE("minecraft:eyeblossom_close"),
EYEBLOSSOM_OPEN("minecraft:eyeblossom_open"),
EYE_OF_ENDER_BUBBLE("minecraft:eye_of_ender_bubble_particle"),
FALLING_BORDER_DUST("minecraft:falling_border_dust_particle"),
FALLING_DUST("minecraft:falling_dust"),
Expand Down Expand Up @@ -108,6 +110,7 @@ public enum ParticleEffect {
OMINOUS_SPAWNING_PARTICLE("minecraft:ominous_spawning_particle"),
OOZING_AMBIENT("minecraft:oozing_ambient"),
OOZING_EMITTER("minecraft:oozing_emitter"),
PALE_OAK_LEAVES_PARTICLE("minecraft:pale_oak_leaves_particle"),
PHANTOM_TRAIL("minecraft:phantom_trail_particle"),
PORTAL_DIRECTIONAL("minecraft:portal_directional"),
PORTAL_EAST_WEST("minecraft:portal_east_west"),
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/cn/nukkit/level/sound/SoundEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public enum SoundEnum {
BLOCK_BOWHIT("block.bowhit"),
BLOCK_CAMPFIRE_CRACKLE("block.campfire.crackle"),
BLOCK_CARTOGRAPHY_TABLE_USE("block.cartography_table.use"),
BLOCK_CAVE_VINES_PLACE("block.cave_vines.place"),
BLOCK_CHORUSFLOWER_DEATH("block.chorusflower.death"),
BLOCK_CHORUSFLOWER_GROW("block.chorusflower.grow"),
BLOCK_CLICK("block.click"),
Expand All @@ -89,6 +90,11 @@ public enum SoundEnum {
BLOCK_ENCHANTING_TABLE_USE("block.enchanting_table.use"),
BLOCK_END_PORTAL_SPAWN("block.end_portal.spawn"),
BLOCK_END_PORTAL_FRAME_FILL("block.end_portal_frame.fill"),
BLOCK_EYEBLOSSOM_AMBIENT("block.eyeblossom.ambient"),
BLOCK_EYEBLOSSOM_CLOSE("block.eyeblossom.close"),
BLOCK_EYEBLOSSOM_CLOSE_LONG("block.eyeblossom.close_long"),
BLOCK_EYEBLOSSOM_OPEN("block.eyeblossom.open"),
BLOCK_EYEBLOSSOM_OPEN_LONG("block.eyeblossom.open_long"),
BLOCK_FALSE_PERMISSIONS("block.false_permissions"),
BLOCK_FURNACE_LIT("block.furnace.lit"),
BLOCK_GRINDSTONE_USE("block.grindstone.use"),
Expand Down Expand Up @@ -159,6 +165,14 @@ public enum SoundEnum {
BLOCK_TURTLE_EGG_BREAK("block.turtle_egg.break"),
BLOCK_TURTLE_EGG_CRACK("block.turtle_egg.crack"),
BLOCK_TURTLE_EGG_DROP("block.turtle_egg.drop"),
BLOCK_WEEPING_VINES_BREAK("block.weeping_vines.break"),
BLOCK_WEEPING_VINES_FALL("block.weeping_vines.fall"),
BLOCK_WEEPING_VINES_HIT("block.weeping_vines.hit"),
BLOCK_WEEPING_VINES_JUMP("block.weeping_vines.jump"),
BLOCK_WEEPING_VINES_LAND("block.weeping_vines.land"),
BLOCK_WEEPING_VINES_PLACE("block.weeping_vines.place"),
BLOCK_WEEPING_VINES_STEP("block.weeping_vines.step"),
BLOCK_WEEPING_VINES_USE("block.weeping_vines.use"),
BLOOM_SCULK_CATALYST("bloom.sculk_catalyst"),
BOTTLE_DRAGONBREATH("bottle.dragonbreath"),
BOTTLE_EMPTY("bottle.empty"),
Expand All @@ -184,6 +198,7 @@ public enum SoundEnum {
BREAK_HANGING_ROOTS("break.hanging_roots"),
BREAK_HANGING_SIGN("break.hanging_sign"),
BREAK_HEAVY_CORE("break.heavy_core"),
BREAK_IRON("break.iron"),
BREAK_LARGE_AMETHYST_BUD("break.large_amethyst_bud"),
BREAK_MEDIUM_AMETHYST_BUD("break.medium_amethyst_bud"),
BREAK_NETHER_WOOD("break.nether_wood"),
Expand Down Expand Up @@ -437,6 +452,7 @@ public enum SoundEnum {
HIT_GRAVEL("hit.gravel"),
HIT_HANGING_ROOTS("hit.hanging_roots"),
HIT_HONEY_BLOCK("hit.honey_block"),
HIT_IRON("hit.iron"),
HIT_LADDER("hit.ladder"),
HIT_MOSS("hit.moss"),
HIT_NETHER_BRICK("hit.nether_brick"),
Expand Down Expand Up @@ -1180,6 +1196,7 @@ public enum SoundEnum {
PLACE_DIRT_WITH_ROOTS("place.dirt_with_roots"),
PLACE_DRIPSTONE_BLOCK("place.dripstone_block"),
PLACE_HANGING_ROOTS("place.hanging_roots"),
PLACE_IRON("place.iron"),
PLACE_LARGE_AMETHYST_BUD("place.large_amethyst_bud"),
PLACE_MEDIUM_AMETHYST_BUD("place.medium_amethyst_bud"),
PLACE_MOSS("place.moss"),
Expand Down Expand Up @@ -1313,6 +1330,7 @@ public enum SoundEnum {
STEP_HANGING_SIGN("step.hanging_sign"),
STEP_HEAVY_CORE("step.heavy_core"),
STEP_HONEY_BLOCK("step.honey_block"),
STEP_IRON("step.iron"),
STEP_LADDER("step.ladder"),
STEP_MOSS("step.moss"),
STEP_NETHER_BRICK("step.nether_brick"),
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/cn/nukkit/network/protocol/ProtocolInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public interface ProtocolInfo {
int CAMERA_SHAKE_PACKET = 0x9f; // 159 c
int PLAYER_FOG_PACKET = 0xa0; // 160 c
int CORRECT_PLAYER_MOVE_PREDICTION_PACKET = 0xa1; // 161 c
int ITEM_COMPONENT_PACKET = 0xa2; // 162 c
int ITEM_REGISTRY_PACKET = 0xa2; // 162 c
int FILTER_TEXT_PACKET = 0xa3; // 163 cs d
int CLIENTBOUND_DEBUG_RENDERER_PACKET = 0xa4; // 164 c
int SYNC_ACTOR_PROPERTY_PACKET = 0xa5; // 165 c
Expand Down Expand Up @@ -269,6 +269,8 @@ public interface ProtocolInfo {
int MOVEMENT_EFFECT_PACKET = 0x13e; // 318 c
int SET_MOVEMENT_AUTHORITY_PACKET = 0x13f; // 319 c
int CAMERA_AIM_ASSIST_PRESETS_PACKET = 0x140; // 320 c
int CLIENT_CAMERA_AIM_ASSIST_PACKET = 0x141; // 321 c
int CLIENT_MOVEMENT_PREDICTION_SYNC_PACKET = 0x142; // 322 s


int COUNT = 1024;
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/types/AbilityLayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package cn.nukkit.network.protocol.types;

import lombok.ToString;

import java.util.EnumSet;
import java.util.Set;

@ToString
public class AbilityLayer {
public static final int TYPE_CACHE = 0;
public static final int TYPE_BASE = 1;
public static final int TYPE_SPECTATOR = 2;
public static final int TYPE_COMMANDS = 3;
/**
* @since 1.19.40
*/
public static final int TYPE_EDITOR = 4;
/**
* @since 1.21.20
*/
public static final int TYPE_LOADING_SCREEN = 5;

public int type = TYPE_BASE;
public Set<PlayerAbility> abilitiesSet = EnumSet.allOf(PlayerAbility.class);
public Set<PlayerAbility> abilityValues = EnumSet.noneOf(PlayerAbility.class);
public float flySpeed = 0.05f;
/**
* @since 1.21.60
*/
public float verticalFlySpeed = 1;
public float walkSpeed = 0.1f;

public AbilityLayer() {
}

public AbilityLayer(int type, Set<PlayerAbility> abilitiesSet, Set<PlayerAbility> abilityValues, float flySpeed, float verticalFlySpeed, float walkSpeed) {
this.type = type;
this.abilitiesSet = abilitiesSet;
this.abilityValues = abilityValues;
this.flySpeed = flySpeed;
this.verticalFlySpeed = verticalFlySpeed;
this.walkSpeed = walkSpeed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public enum PlayerAbility {
* @since 1.19.70
*/
PRIVILEGED_BUILDER,
/**
* @since 1.21.60
*/
VERTICAL_FLY_SPEED,
;

private static final PlayerAbility[] VALUES = values();
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/cn/nukkit/resourcepacks/AbstractResourcePack.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public abstract class AbstractResourcePack implements ResourcePack {
protected String type;
protected final List<String> capabilities = new ArrayList<>();

protected String encryptionKey = "";
protected String cdnUrl = "";

@Override
public String getPackName() {
return this.manifest.getHeader().getName();
Expand Down Expand Up @@ -41,11 +44,21 @@ public List<String> getCapabilities() {

@Override
public String getEncryptionKey() {
return "";
return encryptionKey;
}

@Override
public void setEncryptionKey(String key) {
this.encryptionKey = key;
}

@Override
public String getCdnUrl() {
return null;
return cdnUrl;
}

@Override
public void setCdnUrl(String url) {
this.cdnUrl = url;
}
}
10 changes: 8 additions & 2 deletions src/main/java/cn/nukkit/resourcepacks/ResourcePack.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cn.nukkit.resourcepacks;

import javax.annotation.Nullable;
import java.util.List;

public interface ResourcePack {
Expand All @@ -14,6 +13,10 @@ public interface ResourcePack {

List<String> getCapabilities();

default boolean isBehaviorPack() {
return "data".equals(getPackType());
}

int getPackSize();

byte[] getSha256();
Expand All @@ -24,6 +27,9 @@ public interface ResourcePack {

String getEncryptionKey();

@Nullable
void setEncryptionKey(String key);

String getCdnUrl();

void setCdnUrl(String url);
}
Loading

0 comments on commit e9bcc8d

Please sign in to comment.