Skip to content

Commit

Permalink
Bedrock 1.20.60
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Feb 9, 2024
1 parent b5a72d4 commit c3a9e94
Show file tree
Hide file tree
Showing 95 changed files with 1,121 additions and 350 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@
<version>1.25.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.10.5</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
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 @@ -50,6 +50,7 @@ public enum GameVersion {
V1_20_30(618, "1.20.30"),
V1_20_40(622, "1.20.40"),
V1_20_50(630, "1.20.50"),
V1_20_60(649, "1.20.60"),
;

private static GameVersion FEATURE_VERSION = ENABLE_BLOCK_STATE_PERSISTENCE ? GameVersion.V1_18_0 : GameVersion.V1_12_0;
Expand Down
24 changes: 8 additions & 16 deletions src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ public void onCompletion(Server server) {
return;
}

if (riding != null && (moveVecX != 0 || moveVecY != 0)) {
if (riding != null && (moveVecX != 0 || moveVecY != 0) && riding.isControlling(this)) {
moveVecX = Mth.clamp(moveVecX, -1, 1);
moveVecY = Mth.clamp(moveVecY, -1, 1);

Expand Down Expand Up @@ -2738,19 +2738,11 @@ public void onCompletion(Server server) {
this.newPosition = newPos;
this.forceMovement = null;
}

if (riding != null) {
if (riding instanceof EntityRideable && !(riding instanceof EntityBoat)) {
Vector3f offset = riding.getMountedOffset(this);
((EntityRideable) riding).onPlayerRiding(this.temporalVector.setComponents(movePlayerPacket.x - offset.x, movePlayerPacket.y - offset.y, movePlayerPacket.z - offset.z), (movePlayerPacket.headYaw + 90) % 360, 0);
}
}

break;
case ProtocolInfo.MOVE_ACTOR_ABSOLUTE_PACKET:
MoveEntityPacket moveEntityPacket = (MoveEntityPacket) packet;
if (!validateCoordinate((float) moveEntityPacket.x) || !validateCoordinate((float) moveEntityPacket.y) || !validateCoordinate((float) moveEntityPacket.z)
|| !validateFloat((float) moveEntityPacket.pitch) || !validateFloat((float) moveEntityPacket.yaw) || !validateFloat((float) moveEntityPacket.headYaw)) {
if (!validateCoordinate(moveEntityPacket.x) || !validateCoordinate(moveEntityPacket.y) || !validateCoordinate(moveEntityPacket.z)
|| !validateFloat(moveEntityPacket.pitch) || !validateFloat(moveEntityPacket.yaw) || !validateFloat(moveEntityPacket.headYaw)) {
this.getServer().getLogger().warning("Invalid vehicle movement received: " + this.getName());
this.close("", "Invalid vehicle movement");
return;
Expand All @@ -2760,9 +2752,9 @@ public void onCompletion(Server server) {
break;
}

if (this.riding instanceof EntityBoat) {
if (this.riding instanceof EntityBoat boat) {
if (this.temporalVector.setComponents(moveEntityPacket.x, moveEntityPacket.y, moveEntityPacket.z).distanceSquared(this.riding) < 1000) {
((EntityBoat) this.riding).onInput(moveEntityPacket.x, moveEntityPacket.y, moveEntityPacket.z, moveEntityPacket.yaw);
boat.onInput(moveEntityPacket.x, moveEntityPacket.y, moveEntityPacket.z, moveEntityPacket.yaw % 360);
}
}
break;
Expand Down Expand Up @@ -3700,7 +3692,7 @@ public void onCompletion(Server server) {
}
}

Enchantment[] enchantments = item.getEnchantments();
Enchantment[] enchantments = item.getId() != Item.ENCHANTED_BOOK ? item.getEnchantments() : Enchantment.EMPTY;

ItemAttackDamageEvent event = new ItemAttackDamageEvent(item);
this.server.getPluginManager().callEvent(event);
Expand Down Expand Up @@ -3733,7 +3725,7 @@ public void onCompletion(Server server) {
break;
}

for (Enchantment enchantment : item.getEnchantments()) {
for (Enchantment enchantment : enchantments) {
enchantment.doPostAttack(this, target, null);
}

Expand Down Expand Up @@ -4613,7 +4605,7 @@ public void kill() {

if (!ev.getKeepInventory() && this.level.getGameRules().getBoolean(GameRule.DO_ENTITY_DROPS)) {
for (Item item : ev.getDrops()) {
if (!item.hasEnchantment(Enchantment.VANISHING)) {
if (item.getId() == Item.ENCHANTED_BOOK || !item.hasEnchantment(Enchantment.VANISHING)) {
this.level.dropItem(this, item, null, true, 40);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ public double getBreakTime(Item item, Player player) {
boolean canHarvestWithHand = canHarvestWithHand();
int itemToolType = toolType0(item);
int itemTier = item.getTier();
int efficiencyLoreLevel = Optional.ofNullable(item.getEnchantment(Enchantment.EFFICIENCY))
.map(Enchantment::getLevel).orElse(0);
int efficiencyLoreLevel = item.getId() != Item.ENCHANTED_BOOK ? Optional.ofNullable(item.getEnchantment(Enchantment.EFFICIENCY))
.map(Enchantment::getLevel).orElse(0) : 0;
int hasteEffectLevel = Optional.ofNullable(player.getEffect(Effect.HASTE))
.map(Effect::getAmplifier).orElse(0);
boolean insideOfWaterWithoutAquaAffinity = player.isInsideOfWater() &&
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockAzalea.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ public void setDamage(int meta) {

private boolean canSurvive() {
int id = down().getId();
return id == GRASS || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY;
return id == GRASS_BLOCK || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockBamboo.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,6 @@ public void setThick(boolean thick) {
}

static boolean canBeSupportedBy(int id) {
return id == GRASS || id == DIRT || id == SAND || id == GRAVEL || id == MYCELIUM || id == PODZOL || id == DIRT_WITH_ROOTS;
return id == GRASS_BLOCK || id == DIRT || id == SAND || id == GRAVEL || id == MYCELIUM || id == PODZOL || id == DIRT_WITH_ROOTS;
}
}
4 changes: 4 additions & 0 deletions src/main/java/cn/nukkit/block/BlockCampfire.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ public void onEntityCollide(Entity entity) {
return;
}

if (true) {
return;
}

if (V1_19_60.isAvailable()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockComposter.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private static void registerCompostableItems(float chance, int... itemIds) {
ItemID.BEETROOT_SEEDS,
ItemID.DRIED_KELP,
getItemId(TALLGRASS),
getItemId(GRASS),
getItemId(GRASS_BLOCK),
getItemId(HANGING_ROOTS),
getItemId(MANGROVE_ROOTS),
ItemID.KELP,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockDeadBush.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ public boolean isVegetation() {

private boolean canSurvive() {
int id = down().getId();
return id == SAND || id == HARDENED_CLAY || id == STAINED_HARDENED_CLAY || id == DIRT || id == PODZOL || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MUD || id == GRASS;
return id == SAND || id == HARDENED_CLAY || id == STAINED_HARDENED_CLAY || id == DIRT || id == PODZOL || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MUD || id == GRASS_BLOCK;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockDoublePlant.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ public int getPlantType() {

private boolean canSurvive() {
int id = down().getId();
return id == GRASS || id == DIRT || id == PODZOL || id == FARMLAND || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK;
return id == GRASS_BLOCK || id == DIRT || id == PODZOL || id == FARMLAND || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK;
}
}
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockDripleafBig.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Item[] getDrops(Item item) {
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
Block below = down();
int id = below.getId();
if (!(id == BIG_DRIPLEAF || id == GRASS || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY)) {
if (!(id == BIG_DRIPLEAF || id == GRASS_BLOCK || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY)) {
return false;
}

Expand Down Expand Up @@ -315,7 +315,7 @@ public BlockFace getBlockFace() {

private boolean canSurvive() {
int id = down().getId();
return id == BIG_DRIPLEAF || id == GRASS || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY;
return id == BIG_DRIPLEAF || id == GRASS_BLOCK || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK || id == CLAY;
}

private void setTiltAndScheduleTick(int tilt) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockDripleafSmall.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public boolean place(Item item, Block block, Block target, BlockFace face, doubl
}

int id = down().getId();
if (id != GRASS && id != DIRT && id != MYCELIUM && id != PODZOL && id != FARMLAND && id != DIRT_WITH_ROOTS && id != MOSS_BLOCK && id != CLAY) {
if (id != GRASS_BLOCK && id != DIRT && id != MYCELIUM && id != PODZOL && id != FARMLAND && id != DIRT_WITH_ROOTS && id != MOSS_BLOCK && id != CLAY) {
return false;
}

Expand Down Expand Up @@ -287,7 +287,7 @@ private boolean canSurvive() {
if (!level.getExtraBlock(this).isWater()) {
return false;
}
return id == GRASS || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS;
return id == GRASS_BLOCK || id == DIRT || id == MYCELIUM || id == PODZOL || id == FARMLAND || id == DIRT_WITH_ROOTS;
}

public boolean isUpper() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockFlower.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public boolean onActivate(Item item, BlockFace face, Player player) {
random.nextInt(-1, 2),
random.nextInt(-3, 4));

if (level.getBlock(vec).getId() == AIR && level.getBlock(vec.down()).getId() == GRASS && vec.getY() >= 0 && vec.getY() < 256) {
if (level.getBlock(vec).getId() == AIR && level.getBlock(vec.down()).getId() == GRASS_BLOCK && vec.getY() >= 0 && vec.getY() < 256) {
if (random.nextInt(10) == 0) {
this.level.setBlock(vec, this.getUncommonFlower(), true);
} else {
Expand Down Expand Up @@ -149,6 +149,6 @@ public boolean isVegetation() {

protected boolean canSurvive() {
int id = down().getId();
return id == Block.GRASS || id == Block.DIRT || id == Block.FARMLAND || id == Block.PODZOL || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK;
return id == Block.GRASS_BLOCK || id == Block.DIRT || id == Block.FARMLAND || id == Block.PODZOL || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MOSS_BLOCK;
}
}
Loading

0 comments on commit c3a9e94

Please sign in to comment.