Skip to content

Commit 35e66b9

Browse files
committed
update 1.19.4 (without chat signing)
1 parent 7fd841d commit 35e66b9

File tree

6 files changed

+15302
-8
lines changed

6 files changed

+15302
-8
lines changed

src/main/java/systems/kinau/fishingbot/modules/fishing/RegistryHandler.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class RegistryHandler {
3131
public static Map<Integer, String> itemsMap_1_18 = new HashMap<>();
3232
public static Map<Integer, String> itemsMap_1_19 = new HashMap<>();
3333
public static Map<Integer, String> itemsMap_1_19_3 = new HashMap<>();
34+
public static Map<Integer, String> itemsMap_1_19_4 = new HashMap<>();
3435

3536
public static Map<String, Integer> entitiesMap_1_14 = new HashMap<>();
3637
public static Map<String, Integer> entitiesMap_1_15 = new HashMap<>();
@@ -40,6 +41,7 @@ public class RegistryHandler {
4041
public static Map<String, Integer> entitiesMap_1_18 = new HashMap<>();
4142
public static Map<String, Integer> entitiesMap_1_19 = new HashMap<>();
4243
public static Map<String, Integer> entitiesMap_1_19_3 = new HashMap<>();
44+
public static Map<String, Integer> entitiesMap_1_19_4 = new HashMap<>();
4345

4446
public RegistryHandler(int protocolId) {
4547
JSONObject root = null;
@@ -94,11 +96,15 @@ public RegistryHandler(int protocolId) {
9496
root = (JSONObject) new JSONParser().parse(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("registries_1_19.json")));
9597
break;
9698
}
97-
case ProtocolConstants.MINECRAFT_1_19_3:
98-
default: {
99+
case ProtocolConstants.MINECRAFT_1_19_3: {
99100
root = (JSONObject) new JSONParser().parse(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("registries_1_19_3.json")));
100101
break;
101102
}
103+
case ProtocolConstants.MINECRAFT_1_19_4:
104+
default: {
105+
root = (JSONObject) new JSONParser().parse(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("registries_1_19_4.json")));
106+
break;
107+
}
102108
}
103109
} catch (ParseException | IOException ignore) {
104110
}
@@ -163,8 +169,10 @@ else if (protocol >= ProtocolConstants.MINECRAFT_1_18 && protocol <= ProtocolCon
163169
return itemsMap_1_18;
164170
else if (protocol >= ProtocolConstants.MINECRAFT_1_19 && protocol <= ProtocolConstants.MINECRAFT_1_19_1)
165171
return itemsMap_1_19;
166-
else
172+
else if (protocol == ProtocolConstants.MINECRAFT_1_19_3)
167173
return itemsMap_1_19_3;
174+
else
175+
return itemsMap_1_19_4;
168176
}
169177

170178
public static Map<String, Integer> getEntitiesMap(int protocol) {
@@ -184,7 +192,9 @@ else if (protocol >= ProtocolConstants.MINECRAFT_1_18 && protocol <= ProtocolCon
184192
return entitiesMap_1_18;
185193
else if (protocol >= ProtocolConstants.MINECRAFT_1_19 && protocol <= ProtocolConstants.MINECRAFT_1_19_1)
186194
return entitiesMap_1_19;
187-
else
195+
else if (protocol == ProtocolConstants.MINECRAFT_1_19_3)
188196
return entitiesMap_1_19_3;
197+
else
198+
return entitiesMap_1_19_4;
189199
}
190200
}

src/main/java/systems/kinau/fishingbot/network/protocol/NetworkHandler.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,49 @@ private void initPacketRegistries() {
675675
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_3).registerPacket(0x31, PacketOutBlockPlace.class);
676676
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_3).registerPacket(0x32, PacketOutUseItem.class);
677677

678+
//Minecraft 1.19.4
679+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x01, PacketInSpawnEntity.class);
680+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x0C, PacketInDifficultySet.class);
681+
// TODO: PacketInCommands not working (1.19.3)
682+
// getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x0E, PacketInCommands.class);
683+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x11, PacketInWindowClose.class);
684+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x12, PacketInWindowItems.class);
685+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x14, PacketInSetSlot.class);
686+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x1A, PacketInDisconnect.class);
687+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x23, PacketInKeepAlive.class);
688+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x28, PacketInJoinGame.class);
689+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x30, PacketInOpenWindow.class);
690+
// TODO: PacketInChatPlayer not working (1.19.3)
691+
// getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x31, PacketInChatPlayer.class);
692+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x39, PacketInPlayerListItemRemove.class);
693+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x3A, PacketInPlayerListItem.class);
694+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x3C, PacketInPlayerPosLook.class); //TODO: MISSING BOOLEAN
695+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x4D, PacketInHeldItemChange.class);
696+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x52, PacketInEntityMetadata.class);
697+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x54, PacketInEntityVelocity.class);
698+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x56, PacketInSetExperience.class);
699+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x57, PacketInUpdateHealth.class);
700+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x64, PacketInChatSystem.class);
701+
702+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x00, PacketOutTeleportConfirm.class);
703+
// TODO: Command argument signing (1.19.3)
704+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x04, PacketOutChatCommand.class);
705+
// TODO: Chat signing (1.19.3)
706+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x05, PacketOutChatMessage.class);
707+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x06, PacketOutChatSessionUpdate.class);
708+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x07, PacketOutClientStatus.class);
709+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x08, PacketOutClientSettings.class);
710+
// getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x07, PacketOutConfirmTransaction.class);
711+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x0B, PacketOutClickWindow.class);
712+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x0C, PacketOutCloseInventory.class);
713+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x12, PacketOutKeepAlive.class);
714+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x14, PacketOutPosition.class);
715+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x15, PacketOutPosLook.class);
716+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x1E, PacketOutEntityAction.class);
717+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x28, PacketOutHeldItemChange.class);
718+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x31, PacketOutBlockPlace.class);
719+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_19_4).registerPacket(0x32, PacketOutUseItem.class);
720+
678721
//Register protocol of latest for unknown versions
679722
if (!ProtocolConstants.SUPPORTED_VERSION_IDS.contains(FishingBot.getInstance().getCurrentBot().getServerProtocol())) {
680723
FishingBot.getI18n().severe("network-not-supported-server-version", FishingBot.getInstance().getCurrentBot().getServerProtocol());

src/main/java/systems/kinau/fishingbot/network/protocol/Packet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static void writeString(String s, ByteArrayDataOutput buf) {
4343
buf.write(b);
4444
}
4545

46-
protected static String readString(ByteArrayDataInputWrapper buf) {
46+
public static String readString(ByteArrayDataInputWrapper buf) {
4747
int len = readVarInt(buf);
4848
if (len > Short.MAX_VALUE) {
4949
throw new OverflowPacketException(String.format("Cannot receive string longer than Short.MAX_VALUE (got %s characters)", len));

src/main/java/systems/kinau/fishingbot/network/protocol/play/PacketInPlayerListItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void read(ByteArrayDataInputWrapper in, NetworkHandler networkHandler, in
8484
int count = readVarInt(in);
8585
for (int i = 0; i < count; i++) {
8686
UUID uuid = readUUID(in);
87-
for(Action action : actions) {
87+
for (Action action : actions) {
8888
if (action == Action.ADD_PLAYER)
8989
addedPlayers.add(uuid);
9090
action.reader.read(in);

src/main/java/systems/kinau/fishingbot/network/protocol/play/PacketInPlayerPosLook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class PacketInPlayerPosLook extends Packet {
2323
@Getter private double z;
2424
@Getter private float yaw;
2525
@Getter private float pitch;
26-
@Getter private int teleportId;
26+
@Getter private int teleportId;
2727

2828
@Override
2929
public void write(ByteArrayDataOutput out, int protocolId) {
@@ -46,7 +46,7 @@ public void read(ByteArrayDataInputWrapper in, NetworkHandler networkHandler, in
4646
if(protocolId >= ProtocolConstants.MINECRAFT_1_9) {
4747
this.teleportId = readVarInt(in); //tID
4848
}
49-
if (protocolId >= ProtocolConstants.MINECRAFT_1_17) {
49+
if (protocolId >= ProtocolConstants.MINECRAFT_1_17 && protocolId <= ProtocolConstants.MINECRAFT_1_19_3) {
5050
in.readBoolean(); // should dismount
5151
}
5252
FishingBot.getInstance().getCurrentBot().getEventManager().callEvent(new PosLookChangeEvent(x, y, z, yaw, pitch, teleportId));

0 commit comments

Comments
 (0)