Skip to content

Commit 9ab10a6

Browse files
authored
1.21.110 & updates (#2239)
- Added support for Minecraft 1.21.110/111 - Fixed block break time calculation when flying is allowed on survival - Fixed spectator mode slow fly speed - Fixed some missing block updates - Fixed some recipes not showing up in recipe book - Fixed a typo in projectile_protection in enchant command completion - Added save command auto completion parameters - Added custom form element tooltips - Updated some block friction - More inventory transaction validation fixes - Updated snappy-java to latest
1 parent 6a7c34c commit 9ab10a6

File tree

71 files changed

+277
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+277
-121
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gson = { group = "com.google.code.gson", name = "gson", version = "2.10.1" }
1515
snakeyaml = { group = "org.yaml", name = "snakeyaml", version = "1.33" }
1616
leveldb = { group = "org.iq80.leveldb", name = "leveldb", version = "0.11.1-SNAPSHOT" }
1717
leveldbjni = { group = "net.daporkchop", name = "leveldb-mcpe-jni", version = "0.0.10-SNAPSHOT" }
18-
snappy = { group = "org.xerial.snappy", name = "snappy-java", version = "1.1.10.7" }
18+
snappy = { group = "org.xerial.snappy", name = "snappy-java", version = "1.1.10.8" }
1919
jwt = { group = "com.nimbusds", name = "nimbus-jose-jwt", version = "10.3.1" }
2020
jopt-simple = { group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4" }
2121
blockstateupdater = { group = "org.cloudburstmc", name = "block-state-updater", version = "1.21.40-SNAPSHOT" }

src/main/java/cn/nukkit/Player.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public class Player extends EntityHuman implements CommandSender, InventoryHolde
195195
protected Position spawnPosition;
196196

197197
protected int inAirTicks;
198-
protected int startAirTicks = 10;
198+
protected int startAirTicks = 5;
199199

200200
protected AdventureSettings adventureSettings;
201201
protected Color locatorBarColor;
@@ -501,7 +501,7 @@ public void setAdventureSettings(AdventureSettings adventureSettings) {
501501
*/
502502
public void resetInAirTicks() {
503503
if (this.inAirTicks != 0) {
504-
this.startAirTicks = 10;
504+
this.startAirTicks = 5;
505505
}
506506
this.inAirTicks = 0;
507507
}
@@ -1649,10 +1649,14 @@ public boolean setGamemode(int gamemode, boolean clientSide, AdventureSettings n
16491649
this.dataPacket(pk);
16501650
}
16511651

1652+
if (this.isSpectator()) {
1653+
// Tp not on ground to not fly slowly
1654+
this.teleport(this.add(0, 0.0001, 0), null);
1655+
}
1656+
16521657
this.setAdventureSettings(ev.getNewAdventureSettings());
16531658

16541659
if (this.isSpectator()) {
1655-
this.teleport(this, null);
16561660
this.setDataFlag(DATA_FLAGS, DATA_FLAG_SILENT, true, false);
16571661
this.setDataFlag(DATA_FLAGS, DATA_FLAG_HAS_COLLISION, false); // Sends both
16581662
} else {
@@ -2359,7 +2363,7 @@ public boolean onUpdate(int currentTick) {
23592363
PlayerInvalidMoveEvent ev = new PlayerInvalidMoveEvent(this, true);
23602364
this.getServer().getPluginManager().callEvent(ev);
23612365
if (!ev.isCancelled()) {
2362-
this.startAirTicks = this.inAirTicks - 10;
2366+
this.startAirTicks = this.inAirTicks - 5;
23632367
this.setMotion(new Vector3(0, expectedVelocity, 0));
23642368
}
23652369
} else if (this.kick(PlayerKickEvent.Reason.FLYING_DISABLED, MSG_FLYING_NOT_ENABLED, true)) {
@@ -4160,8 +4164,8 @@ public void onCompletion(Server server) {
41604164
if (this.loomTransaction.execute()) {
41614165
level.addLevelSoundEvent(this, LevelSoundEventPacket.SOUND_BLOCK_LOOM_USE);
41624166
}
4163-
this.loomTransaction = null;
41644167
}
4168+
this.loomTransaction = null; // Must be here or stuff will break
41654169
return;
41664170
}
41674171

@@ -5349,7 +5353,7 @@ public void close(TextContainer message, String reason, boolean notify) {
53495353
if (notify && !reason.isEmpty()) {
53505354
DisconnectPacket pk = new DisconnectPacket();
53515355
// New disconnection screen doesn't support colors :(
5352-
pk.message = reason = TextFormat.clean(reason);
5356+
pk.message = TextFormat.clean(reason);
53535357
this.forceDataPacket(pk, null);
53545358
}
53555359

src/main/java/cn/nukkit/block/Block.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.nukkit.block;
22

3+
import cn.nukkit.AdventureSettings;
34
import cn.nukkit.Player;
45
import cn.nukkit.Server;
56
import cn.nukkit.entity.Entity;
@@ -566,7 +567,7 @@ public double getBreakTime(Item item, Player player) {
566567
boolean insideOfWaterWithoutAquaAffinity = player.isInsideOfWater() &&
567568
Optional.ofNullable(player.getInventory().getHelmet().getEnchantment(Enchantment.ID_WATER_WORKER))
568569
.map(Enchantment::getLevel).map(l -> l >= 1).orElse(false);
569-
boolean outOfWaterButNotOnGround = (!player.isInsideOfWater()) && (!player.isOnGround());
570+
boolean outOfWaterButNotOnGround = !player.isOnGround() && !player.getAdventureSettings().get(AdventureSettings.Type.FLYING) && !player.isInsideOfWater();
570571
return breakTime0(blockHardness, correctTool, canHarvestWithHand, blockId, itemToolType, itemTier,
571572
efficiencyLoreLevel, hasteEffectLevel, insideOfWaterWithoutAquaAffinity, outOfWaterButNotOnGround);
572573
}

src/main/java/cn/nukkit/block/BlockButton.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public boolean onActivate(Item item, Player player) {
5656

5757
this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 0, 15));
5858
this.setDamage(this.getDamage() ^ 0x08);
59-
this.level.setBlock(this, this, true, false);
59+
this.level.setBlock(this, this, true, true);
6060
this.level.addLevelSoundEvent(this, LevelSoundEventPacket.SOUND_POWER_ON);
6161
this.level.scheduleUpdate(this, 30);
6262

@@ -77,7 +77,7 @@ public int onUpdate(int type) {
7777
this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 15, 0));
7878

7979
this.setDamage(this.getDamage() ^ 0x08);
80-
this.level.setBlock(this, this, true, false);
80+
this.level.setBlock(this, this, true, true);
8181
this.level.addLevelSoundEvent(this, LevelSoundEventPacket.SOUND_POWER_OFF);
8282

8383
level.updateAroundRedstone(this, null);

src/main/java/cn/nukkit/block/BlockChain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public BlockChain(int meta) {
1717

1818
@Override
1919
public String getName() {
20-
return "Chain";
20+
return "Iron Chain";
2121
}
2222

2323
@Override

src/main/java/cn/nukkit/block/BlockFenceGate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public boolean toggle(Player player) {
180180
}
181181

182182
this.setDamage(direction | ((~this.getDamage()) & 0x04));
183-
this.level.setBlock(this, this, true, false);
183+
this.level.setBlock(this, this, true, true);
184184
if (this.isOpen()) {
185185
this.level.addSound(this, Sound.RANDOM_DOOR_OPEN);
186186
} else {

src/main/java/cn/nukkit/block/BlockHoneyBlock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ public void onEntityCollide(Entity entity) {
5353
}
5454
}
5555
}
56+
57+
@Override
58+
public double getFrictionFactor() {
59+
return 0.8;
60+
}
5661
}

src/main/java/cn/nukkit/block/BlockLava.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void onEntityCollide(Entity entity) {
7575

7676
@Override
7777
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
78-
boolean ret = this.getLevel().setBlock(this, this, true, false);
78+
boolean ret = this.getLevel().setBlock(this, this, true, true);
7979
this.getLevel().scheduleUpdate(this, this.tickRate());
8080

8181
return ret;

src/main/java/cn/nukkit/block/BlockLightBlock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ public Item toItem() {
7272
public boolean canBePushed() {
7373
return false;
7474
}
75+
76+
@Override
77+
public double getFrictionFactor() {
78+
return 0.9;
79+
}
7580
}

src/main/java/cn/nukkit/block/BlockMushroom.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public boolean onActivate(Item item, Player player) {
7171
}
7272

7373
public boolean grow() {
74-
this.level.setBlock(this, Block.get(BlockID.AIR), true, false);
74+
this.level.setBlock(this, Block.get(BlockID.AIR), true, true);
7575

7676
BigMushroom generator = new BigMushroom(getType());
7777

0 commit comments

Comments
 (0)