From 02781ed56ce313b8baf182e7addee0f126129dba Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Sat, 20 Jun 2020 20:32:03 -0400 Subject: [PATCH] Fix some whitespacing; fix some tests --- .../com/github/steveice10/mc/protocol/data/MagicValues.java | 1 + .../github/steveice10/mc/protocol/data/game/chunk/Chunk.java | 2 +- .../protocol/packet/ingame/server/ServerJoinGamePacket.java | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java b/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java index f9e3c674..7080a433 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java @@ -118,6 +118,7 @@ public class MagicValues { register(AttributeType.GENERIC_KNOCKBACK_RESISTANCE, "generic.knockback_resistance"); register(AttributeType.GENERIC_MOVEMENT_SPEED, "generic.movement_speed"); register(AttributeType.GENERIC_ATTACK_DAMAGE, "generic.attack_damage"); + register(AttributeType.GENERIC_ATTACK_KNOCKBACK, "generic.attack_knockback"); register(AttributeType.GENERIC_ATTACK_SPEED, "generic.attack_speed"); register(AttributeType.GENERIC_ARMOR, "generic.armor"); register(AttributeType.GENERIC_ARMOR_TOUGHNESS, "generic.armor_toughness"); diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Chunk.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Chunk.java index c48c4ca8..1feaff88 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Chunk.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Chunk.java @@ -34,7 +34,7 @@ public class Chunk { int bitsPerEntry = in.readUnsignedByte(); List states = new ArrayList<>(); - int stateCount = bitsPerEntry > 8 || bitsPerEntry == 0 ? 0 : in.readVarInt(); + int stateCount = bitsPerEntry > 8 || bitsPerEntry == 0 ? 0 : in.readVarInt(); for(int i = 0; i < stateCount; i++) { states.add(in.readVarInt()); } diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java index 8f866d65..1cef9d78 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java @@ -50,8 +50,9 @@ public class ServerJoinGamePacket implements Packet { this.gameMode = MagicValues.key(GameMode.class, gameMode & GAMEMODE_MASK); this.gameMode2 = MagicValues.key(GameMode.class, in.readUnsignedByte()); this.worldCount = in.readVarInt(); + this.worldNames = new String[this.worldCount]; for (int i = 0; i < this.worldCount; i++) { - in.readString(); + this.worldNames[i] = in.readString(); } this.dimensionCodec = NBT.read(in); this.dimension = in.readString(); @@ -70,7 +71,7 @@ public class ServerJoinGamePacket implements Packet { out.writeInt(this.entityId); int gameMode = MagicValues.value(Integer.class, this.gameMode) & GAMEMODE_MASK; - if(this.hardcore) { + if (this.hardcore) { gameMode |= GAMEMODE_FLAG_HARDCORE; }