Skip to content

Commit 0f34cbb

Browse files
committed
为新内容做准备
1 parent 0df2d39 commit 0f34cbb

Some content is hidden

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

43 files changed

+107
-47
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,12 +2330,12 @@ protected void processLogin() {
23302330
for (Player p : new ObjectArrayList<>(this.server.getOnlinePlayers().values())) {
23312331
if (p != this && p.getName() != null && p.getName().equalsIgnoreCase(this.getName())) {
23322332
if (!p.kick(PlayerKickEvent.Reason.NEW_CONNECTION, "logged in from another location")) {
2333-
this.close(this.getLeaveMessage(), "Already connected");
2333+
this.close(this.getLeaveMessage(), "disconnectionScreen.loggedinOtherLocation");
23342334
return;
23352335
}
23362336
} else if (p.loggedIn && this.getUniqueId().equals(p.getUniqueId())) {
23372337
if (!p.kick(PlayerKickEvent.Reason.NEW_CONNECTION, "logged in from another location")) {
2338-
this.close(this.getLeaveMessage(), "Already connected");
2338+
this.close(this.getLeaveMessage(), "disconnectionScreen.loggedinOtherLocation");
23392339
return;
23402340
}
23412341
}
@@ -3034,7 +3034,12 @@ public void onCompletion(Server server) {
30343034
if (this.isBreakingBlock()) {
30353035
block = this.level.getBlock(pos, false);
30363036
face = BlockFace.fromIndex(playerActionPacket.data);
3037-
this.level.addParticle(new PunchBlockParticle(pos, block, face));
3037+
Vector3 blockCenter = pos.blockCenter();
3038+
this.level.addParticle(new PunchBlockParticle(blockCenter, block, face));
3039+
level.addLevelEvent(blockCenter, LevelEventPacket.EVENT_PARTICLE_PUNCH_BLOCK_DOWN + face.getIndex(), block.getFullId());
3040+
3041+
int breakTime = Mth.ceil(block.getBreakTime(inventory.getItemInHand(), this) * 20);
3042+
level.addLevelEvent(pos, LevelEventPacket.EVENT_BLOCK_UPDATE_BREAK, breakTime <= 0 ? 0 : 65535 / breakTime);
30383043
}
30393044
break;
30403045
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ private float getDestroySpeed(Item item, boolean correctTool) {
712712
if (is(WEB) || isLeaves()) {
713713
return 15;
714714
}
715-
if (is(WOOL)) {
715+
if (isWool()) {
716716
return 5;
717717
}
718718
if (is(VINE) || is(GLOW_LICHEN)) {
@@ -1414,6 +1414,10 @@ public boolean isCauldron() {
14141414
return false;
14151415
}
14161416

1417+
public boolean isWool() {
1418+
return false;
1419+
}
1420+
14171421
public boolean isWaxed() {
14181422
return false;
14191423
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ public void increaseStrength() {
7979
}
8080

8181
public Instrument getInstrument() {
82-
switch (this.down().getId()) {
82+
Block below = this.down();
83+
if (below.isWool()) {
84+
return Instrument.GUITAR;
85+
}
86+
switch (below.getId()) {
8387
case GOLD_BLOCK:
8488
return Instrument.GLOCKENSPIEL;
8589
case CLAY:
8690
return Instrument.FLUTE;
8791
case PACKED_ICE:
8892
return Instrument.CHIME;
89-
case WOOL:
90-
return Instrument.GUITAR;
9193
case BONE_BLOCK:
9294
return Instrument.XYLOPHONE;
9395
case IRON_BLOCK:

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ public BlockColor getColor() {
6464
public DyeColor getDyeColor() {
6565
return DyeColor.getByWoolData(getDamage());
6666
}
67+
68+
@Override
69+
public boolean isWool() {
70+
return true;
71+
}
6772
}

src/main/java/cn/nukkit/command/CommandParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ public Vector2 senderAsVector2() {
874874
public Block parseBlock() throws CommandSyntaxException {
875875
String arg = this.next();
876876
try {
877-
Block block = Block.fromStringNullable(arg, true);
877+
Block block = Block.fromStringNullable(arg.toLowerCase(), true);
878878
if (block == null) {
879879
throw CommandExceptions.COMMAND_SYNTAX_EXCEPTION;
880880
}
@@ -901,7 +901,7 @@ public Block parseBlockOrDefault(Supplier<Block> defaultValue) throws CommandSyn
901901
public Item parseItem() throws CommandSyntaxException {
902902
String arg = this.next();
903903
try {
904-
Item item = Item.fromStringNullable(arg, true);
904+
Item item = Item.fromStringNullable(arg.toLowerCase(), true);
905905
if (item == null) {
906906
throw CommandExceptions.COMMAND_SYNTAX_EXCEPTION;
907907
}

src/main/java/cn/nukkit/item/ItemArmor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected ItemArmor(int id, Integer meta, int count) {
3434
}
3535

3636
protected ItemArmor(int id, Integer meta, int count, String name) {
37-
super(id, meta, 1, name);
37+
super(id, meta, count, name);
3838
}
3939

4040
@Override

src/main/java/cn/nukkit/item/ItemBannerPattern.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ItemBannerPattern(Integer meta) {
3535
}
3636

3737
public ItemBannerPattern(Integer meta, int count) {
38-
super(BANNER_PATTERN, meta, 1, getName(meta != null ? meta : 0));
38+
super(BANNER_PATTERN, meta, count, getName(meta != null ? meta : 0));
3939
}
4040

4141
@Override

src/main/java/cn/nukkit/item/ItemBed.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public ItemBed(Integer meta) {
1919
}
2020

2121
public ItemBed(Integer meta, int count) {
22-
super(BED, meta, 1, DyeColor.getByWoolData(meta != null ? meta : 0).getName() + " Bed");
22+
super(BED, meta, count, DyeColor.getByWoolData(meta != null ? meta : 0).getName() + " Bed");
2323
this.block = Block.get(BlockID.BLOCK_BED);
2424
}
2525

src/main/java/cn/nukkit/item/ItemBeetrootSoup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public ItemBeetrootSoup(Integer meta) {
1515
}
1616

1717
public ItemBeetrootSoup(Integer meta, int count) {
18-
super(BEETROOT_SOUP, 0, 1, "Beetroot Soup");
18+
super(BEETROOT_SOUP, 0, count, "Beetroot Soup");
1919
}
2020

2121
@Override

src/main/java/cn/nukkit/item/ItemBoat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public ItemBoat(Integer meta) {
3333
}
3434

3535
public ItemBoat(Integer meta, int count) {
36-
super(BOAT, meta, 1, "Boat");
36+
super(BOAT, meta, count, "Boat");
3737
}
3838

3939
protected ItemBoat(int id, Integer meta, int count, String name) {

0 commit comments

Comments
 (0)