Skip to content

Commit 72ca1c3

Browse files
committed
1.19-pre1
1 parent 62a24ae commit 72ca1c3

File tree

7 files changed

+57
-3
lines changed

7 files changed

+57
-3
lines changed

Minecraft_1.19_Snapshot_docs.txt

+7
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ boolean | Contains preview | Whether or not the following preview message is sen
189189
Chat | Preview message | The preview of the message you just sent with a chat-packet if preview=true
190190
----------------------------------------------------------------------------------------------------------
191191

192+
Allow Preview packet (client-bound)
193+
----------------------------------------------------------------------------------------------------------
194+
This packet was introduced in 1.19-pre1 to tell the client that it will not get previews
195+
196+
Boolean | Enabled | Whether or not the server will accept/send chat preview packets
197+
----------------------------------------------------------------------------------------------------------
198+
192199
Join Game (client-bound)
193200
----------------------------------------------------------------------------------------------------------
194201
Int | Entity ID | The entity ID of the player

java/src/me/dustin/chatbot/chat/Translator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Translator {
1111
public static void setTranslation(String translation) {
1212
try {
1313
String v = ProtocolHandler.getCurrent().getName().replace(".", "_");
14-
if (v.contains("pre") || v.contains("w"))
14+
if (v.toLowerCase().contains("pre") || v.toLowerCase().contains("w"))
1515
v = "1_19";
1616
//fat fuckin mess to create the version id needed for the link, i.e. 1_12 from 1.12.2
1717
if (v.split("_").length > 2)

java/src/me/dustin/chatbot/entity/Entity.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ public static boolean isLiving(String name) {
109109

110110
static {
111111
String v = ProtocolHandler.getCurrent().getName().replace(".", "_");
112-
if (v.contains("pre") || v.contains("w"))
112+
if (v.toLowerCase().contains("pre") || v.toLowerCase().contains("w"))
113113
v = "1_19";
114+
System.out.println(v);
114115
//fat fuckin mess to create the version id needed for the link, i.e. 1_12 from 1.12.2
115116
if (v.split("_").length > 2)
116117
v = v.split("_")[0] + "_" + v.split("_")[1];

java/src/me/dustin/chatbot/network/ClientConnection.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class ClientConnection {
7373
private boolean isEncrypted;
7474
private boolean isInGame;
7575
private boolean serverDoesPreview;
76+
private boolean allowPreviews;
7677

7778
private final World world;
7879
private final ClientPlayer clientPlayer;
@@ -366,7 +367,7 @@ public void setPendingMessage(String pendingMessage) {
366367
}
367368

368369
public boolean serverDoesPreview() {
369-
return this.serverDoesPreview;
370+
return this.serverDoesPreview && isAllowPreviews();
370371
}
371372

372373
public void setServerDoesPreview(boolean hasChatPreview) {
@@ -410,6 +411,14 @@ public boolean isChannelOpen() {
410411
return channel != null && channel.isOpen();
411412
}
412413

414+
public boolean isAllowPreviews() {
415+
return allowPreviews;
416+
}
417+
418+
public void setAllowPreviews(boolean allowPreviews) {
419+
this.allowPreviews = allowPreviews;
420+
}
421+
413422
public enum NetworkState {
414423
HANDSHAKE, PLAY, STATUS, LOGIN
415424
}

java/src/me/dustin/chatbot/network/packet/handler/PlayClientBoundPacketHandler.java

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ public void handleUpdateHealthPacket(ClientBoundUpdateHealthPacket clientBoundUp
161161

162162
public void handleCustomDataPacket(ClientBoundCustomDataPacket clientBoundCustomDataPacket) {}
163163

164+
public void handleSetPreviewEnabledPacket(ClientBoundSetPreviewEnabledPacket clientBoundSetPreviewEnabledPacket) {
165+
getClientConnection().setAllowPreviews(clientBoundSetPreviewEnabledPacket.isEnabled());
166+
}
167+
164168
public void handleRemoveEntitiesPacket(ClientBoundRemoveEntities clientBoundRemoveEntities) {
165169
for (int entityId : clientBoundRemoveEntities.getEntityIds()) {
166170
Entity entity = getClientConnection().getWorld().getEntity(entityId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package me.dustin.chatbot.network.packet.impl.play.s2c;
2+
3+
import me.dustin.chatbot.network.packet.Packet;
4+
import me.dustin.chatbot.network.packet.handler.ClientBoundPacketHandler;
5+
import me.dustin.chatbot.network.packet.handler.PlayClientBoundPacketHandler;
6+
import me.dustin.chatbot.network.packet.pipeline.PacketByteBuf;
7+
8+
public class ClientBoundSetPreviewEnabledPacket extends Packet.ClientBoundPacket {
9+
private final boolean enabled;
10+
public ClientBoundSetPreviewEnabledPacket(PacketByteBuf packetByteBuf) {
11+
super(packetByteBuf);
12+
this.enabled = packetByteBuf.readBoolean();
13+
}
14+
15+
@Override
16+
public void handlePacket(ClientBoundPacketHandler clientBoundPacketHandler) {
17+
((PlayClientBoundPacketHandler)clientBoundPacketHandler).handleSetPreviewEnabledPacket(this);
18+
}
19+
20+
public boolean isEnabled() {
21+
return enabled;
22+
}
23+
}

versions/protocol_versions.json

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2+
"841": {
3+
"name": "1.19 Pre-release 1",
4+
"protocol_id": 1073741909,
5+
"packets": {
6+
"c2s": ["confirm_teleport", "block_nbt", "difficulty", "command_message", "chat_message", "chat_preview", "client_action", "settings", "chat_suggestions", "container_button", "container_click", "close_container", "plugin", "book", "entity_nbt", "entity_interact", "generate_structure", "heartbeat", "lock_difficulty", "position", "position_rotation", "rotation", "ground_change", "move_vehicle", "steer_boat", "item_pick", "crafting_recipe", "toggle_fly", "player_action", "entity_action", "steer_vehicle", "pong", "displayed_recipe", "recipe_book", "anvil_item_name", "resourcepack", "advancement_tab", "trade", "beacon_effect", "hotbar_slot", "command_block", "minecart_command_block", "item_stack_create", "jigsaw_block", "structure_block", "sign_text", "swing_arm", "entity_spectate", "block_interact", "use_item"
7+
],
8+
"s2c": ["entity_object_spawn", "entity_experience_orb", "entity_player", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "chat_preview", "clear_title", "chat_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "plugin", "named_sound", "kick", "entity_status", "explosion", "unload_chunk", "game_event", "open_horse_container", "initialize_world_border", "heartbeat", "chunk", "world_event", "particle", "chunk_light", "initialize", "map", "villager_trades", "relative_move", "movement_rotation", "rotation", "move_vehicle", "book", "open_container", "sign_editor", "ping", "crafting_recipe", "player_abilities", "chat_message", "end_combat_event", "enter_combat_event", "kill_combat_event", "tab_list", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "server_data", "hotbar_text", "center_world_border", "interpolate_world_border", "size_world_border", "warn_time_world_border", "warn_blocks_world_border", "camera", "hotbar_slot", "chunk_center", "view_distance", "compass_position", "allow_preview", "objective_position", "entity_data", "entity_attach", "velocity", "entity_equipment", "experience", "health", "objective", "entity_passenger", "teams", "scoreboard_score", "simulation_distance", "subtitle", "time", "title_text", "title_times", "entity_sound", "sound_event", "stop_sound", "game_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"
9+
]
10+
}
11+
},
212
"840": {
313
"name": "22w19a",
414
"protocol_id": 1073741908,

0 commit comments

Comments
 (0)