Skip to content

Commit

Permalink
Bedrock 1.20.30
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Sep 21, 2023
1 parent 02fe18e commit 6f6a4e5
Show file tree
Hide file tree
Showing 133 changed files with 809 additions and 268 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 @@ -47,6 +47,7 @@ public enum GameVersion {
V1_19_80(582, "1.19.80"),
V1_20_0(589, "1.20.0", "1.20"),
V1_20_10(594, "1.20.10"),
V1_20_30(618, "1.20.30"),
;

private static GameVersion FEATURE_VERSION = ENABLE_BLOCK_STATE_PERSISTENCE ? GameVersion.V1_18_0 : GameVersion.V1_12_0;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cn/nukkit/SharedConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public final class SharedConstants {

public static final int RESOURCE_PACK_CHUNK_SIZE = 128 * 1024; // 128KB

public static final boolean ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY = true;

public static final boolean ENABLE_BLOCK_STATE_PERSISTENCE = true;

public static final boolean ENABLE_ITEM_NAME_PERSISTENCE = true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockAncientDebris.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 3600;
return 6000;
}

@Override
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/cn/nukkit/block/BlockBamboo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.util.concurrent.ThreadLocalRandom;

import static cn.nukkit.GameVersion.*;
import static cn.nukkit.SharedConstants.*;

public class BlockBamboo extends BlockTransparentMeta {

public static final int STALK_THICKNESS_BIT = 0b1;
Expand Down Expand Up @@ -50,12 +53,15 @@ public int getToolType() {

@Override
public double getHardness() {
if (ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY || V1_20_30.isAvailable()) {
return 1;
}
return 2;
}

@Override
public double getResistance() {
return 10;
return 5;
}

@Override
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/cn/nukkit/block/BlockBambooSapling.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import cn.nukkit.math.BlockFace;
import cn.nukkit.utils.BlockColor;

import static cn.nukkit.GameVersion.*;

public class BlockBambooSapling extends BlockFlowable {

public static final int AGE_BIT = 0b1;
Expand All @@ -31,6 +33,19 @@ public String getName() {
return "Bamboo Sapling";
}

@Override
public double getHardness() {
if (V1_20_30.isAvailable()) {
return 1;
}
return 0;
}

@Override
public double getResistance() {
return 5;
}

@Override
public int getBurnChance() {
return 5;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockBeeNest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 13.5;
return 1.5;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockBeehive.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 27;
return 3;
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/cn/nukkit/block/BlockBell.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import javax.annotation.Nullable;

import static cn.nukkit.GameVersion.*;

public class BlockBell extends BlockTransparentMeta implements Faceable {

public static final int DIRECTION_MASK = 0b11;
Expand Down Expand Up @@ -57,12 +59,15 @@ public int getToolType() {

@Override
public double getHardness() {
if (V1_20_30.isAvailable()) {
return 5;
}
return 1;
}

@Override
public double getResistance() {
return 15;
return 25;
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cn/nukkit/block/BlockBlackstonePolished.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import cn.nukkit.item.ItemTool;
import cn.nukkit.utils.BlockColor;

import static cn.nukkit.GameVersion.*;

public class BlockBlackstonePolished extends BlockSolid {
public BlockBlackstonePolished() {
}
Expand All @@ -20,6 +22,9 @@ public String getName() {

@Override
public double getHardness() {
if (V1_20_30.isAvailable()) {
return 2;
}
return 1.5;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockBricksDeepslate.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 18;
return 30;
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/cn/nukkit/block/BlockBricksEndStone.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import cn.nukkit.item.ItemTool;
import cn.nukkit.utils.BlockColor;

import static cn.nukkit.GameVersion.*;

public class BlockBricksEndStone extends BlockSolid {

public BlockBricksEndStone() {
Expand All @@ -26,12 +28,15 @@ public int getToolType() {

@Override
public double getHardness() {
if (V1_20_30.isAvailable()) {
return 3;
}
return 0.8;
}

@Override
public double getResistance() {
return 4;
return 45;
}

@Override
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/cn/nukkit/block/BlockBricksMud.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import cn.nukkit.item.ItemTool;
import cn.nukkit.utils.BlockColor;

import static cn.nukkit.GameVersion.*;
import static cn.nukkit.SharedConstants.*;

public class BlockBricksMud extends BlockSolid {
public BlockBricksMud() {
}
Expand All @@ -20,12 +23,15 @@ public String getName() {

@Override
public double getHardness() {
if (ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY || V1_20_30.isAvailable()) {
return 1.5;
}
return 2;
}

@Override
public double getResistance() {
return 10;
return 15;
}

@Override
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/cn/nukkit/block/BlockCampfire.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.annotation.Nullable;

import static cn.nukkit.GameVersion.*;
import static cn.nukkit.SharedConstants.*;

public class BlockCampfire extends BlockTransparentMeta implements Faceable {

Expand Down Expand Up @@ -67,12 +68,15 @@ public int getToolType() {

@Override
public double getHardness() {
if (ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY || V1_20_30.isAvailable()) {
return 2;
}
return 5;
}

@Override
public double getResistance() {
return 25;
return 10;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 15;
return 30;
}

@Override
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/cn/nukkit/block/BlockComposter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

import java.util.concurrent.ThreadLocalRandom;

import static cn.nukkit.GameVersion.*;
import static cn.nukkit.SharedConstants.*;

public class BlockComposter extends BlockTransparentMeta {

private static final Int2FloatMap COMPOSTABLES = new Int2FloatOpenHashMap();
Expand All @@ -40,12 +43,15 @@ public int getId() {

@Override
public double getHardness() {
if (ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY || V1_20_30.isAvailable()) {
return 0.6;
}
return 2;
}

@Override
public double getResistance() {
return 10;
return 3;
}

@Override
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/cn/nukkit/block/BlockConcretePowder.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import cn.nukkit.item.ItemTool;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.utils.BlockColor;
import cn.nukkit.utils.DyeColor;

/**
* Created by CreeperFace on 2.6.2017.
Expand Down Expand Up @@ -42,7 +44,7 @@ public int getId() {

@Override
public String getName() {
return "Concrete Powder";
return getDyeColor().getName() + " Concrete Powder";
}

@Override
Expand Down Expand Up @@ -99,4 +101,13 @@ public boolean place(Item item, Block b, Block target, BlockFace face, double fx

return true;
}

@Override
public BlockColor getColor() {
return getDyeColor().getColor();
}

public DyeColor getDyeColor() {
return DyeColor.getByWoolData(getDamage());
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockCopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 18;
return 30;
}

@Override
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCoralBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import cn.nukkit.item.ItemTool;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.math.Vector3;
import cn.nukkit.utils.BlockColor;

import java.util.concurrent.ThreadLocalRandom;

import static cn.nukkit.GameVersion.*;
import static cn.nukkit.SharedConstants.*;

public class BlockCoralBlock extends BlockSolidMeta {

public static final int COLOR_MASK = 0b111;
Expand Down Expand Up @@ -52,12 +54,15 @@ public String getName() {

@Override
public double getHardness() {
if (ENABLE_BLOCK_DESTROY_SPEED_COMPATIBILITY || V1_20_30.isAvailable()) {
return 1.5;
}
return 7;
}

@Override
public double getResistance() {
return 4.5;
return 30;
}

@Override
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/cn/nukkit/block/BlockCoralFan.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cn.nukkit.Player;
import cn.nukkit.item.Item;
import cn.nukkit.level.Level;
import cn.nukkit.math.AxisAlignedBB;
import cn.nukkit.math.BlockFace;
import cn.nukkit.math.Mth;
import cn.nukkit.math.Vector3;
Expand Down Expand Up @@ -55,11 +54,6 @@ public String getName() {
return NAMES[getCoralColor()];
}

@Override
public double getResistance() {
return 4.5;
}

@Override
public boolean canSilkTouch() {
return true;
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/cn/nukkit/block/BlockCoralFanHang.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import cn.nukkit.item.Item;
import cn.nukkit.level.Level;
import cn.nukkit.math.AxisAlignedBB;
import cn.nukkit.math.BlockFace;
import cn.nukkit.utils.BlockColor;
import cn.nukkit.utils.Faceable;
Expand Down Expand Up @@ -37,11 +36,6 @@ public String getName() {
return getCoralType() == BLUE ? "Hang Tube Coral Fan" : "Hang Brain Coral Fan";
}

@Override
public double getResistance() {
return 4.5;
}

@Override
public boolean canSilkTouch() {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockCraftingTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public double getHardness() {

@Override
public double getResistance() {
return 15;
return 12.5;
}

@Override
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;
return id == SAND || id == HARDENED_CLAY || id == STAINED_HARDENED_CLAY || id == DIRT || id == PODZOL || id == MYCELIUM || id == DIRT_WITH_ROOTS || id == MUD || id == GRASS;
}
}
Loading

0 comments on commit 6f6a4e5

Please sign in to comment.