From 27ab117b7ddf21a0c83927e5494a5c809b52d2a9 Mon Sep 17 00:00:00 2001 From: Elikill58 Date: Sat, 16 Nov 2024 19:24:56 +0100 Subject: [PATCH] Fix 1.21.3 support --- .../negativity/api/packets/PacketType.java | 25 +++- .../api/packets/nms/versions/Version1_13.java | 2 +- .../api/packets/nms/versions/Version1_14.java | 2 +- .../packets/nms/versions/Version1_14_4.java | 2 +- .../api/packets/nms/versions/Version1_15.java | 2 +- .../api/packets/nms/versions/Version1_16.java | 2 +- .../api/packets/nms/versions/Version1_17.java | 2 +- .../api/packets/nms/versions/Version1_18.java | 2 +- .../api/packets/nms/versions/Version1_19.java | 2 +- .../packets/nms/versions/Version1_19_2.java | 2 +- .../packets/nms/versions/Version1_19_3.java | 2 +- .../packets/nms/versions/Version1_19_4.java | 2 +- .../api/packets/nms/versions/Version1_20.java | 2 +- .../packets/nms/versions/Version1_20_2.java | 2 +- .../packets/nms/versions/Version1_20_4.java | 2 +- .../packets/nms/versions/Version1_20_6.java | 2 +- .../api/packets/nms/versions/Version1_21.java | 112 +++++++----------- .../packets/nms/versions/Version1_21_3.java | 68 +++++++++++ .../playin/NPacketPlayInSteerVehicle.java | 37 +++++- .../negativity/universal/Version.java | 4 +- .../NegativityTranslationProviderFactory.java | 2 +- .../negativity/spigot/SpigotAdapter.java | 27 +++-- .../spigot/nms/SpigotVersionAdapter.java | 17 +-- .../negativity/spigot/nms/Spigot_1_21_R1.java | 3 +- .../negativity/spigot/utils/PacketUtils.java | 4 +- .../negativity/spigot/utils/Utils.java | 5 + 26 files changed, 215 insertions(+), 119 deletions(-) create mode 100644 common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21_3.java diff --git a/common/src/com/elikill58/negativity/api/packets/PacketType.java b/common/src/com/elikill58/negativity/api/packets/PacketType.java index 223262956..4fe5ed5a7 100644 --- a/common/src/com/elikill58/negativity/api/packets/PacketType.java +++ b/common/src/com/elikill58/negativity/api/packets/PacketType.java @@ -176,6 +176,7 @@ enum Client implements PacketType { BOAT_MOVE, BLOCK_DIG(NPacketPlayInBlockDig::new), BLOCK_PLACE(NPacketPlayInBlockPlace::new), + BUNDLE_ITEM_SELECTED, CHAT(NPacketPlayInChat::new), CHAT_ACK, CHAT_COMMAND, @@ -228,8 +229,9 @@ enum Client implements PacketType { STRUCT, TAB_COMPLETE, TELEPORT_ACCEPT(NPacketPlayInTeleportAccept::new), + TICK_END, TILE_NBT_QUERY, - TR_SEL, + TRADE_SELECT, PONG(NPacketPlayInPong::new), UPDATE_SIGN, USE_ENTITY(NPacketPlayInUseEntity::new), @@ -323,6 +325,7 @@ enum Server implements PacketType { ENTITY_EQUIPMENT, ENTITY_HEAD_ROTATION(NPacketPlayOutEntityHeadRotation::new), ENTITY_METADATA, + ENTITY_POSITION_SYNC, ENTITY_STATUS, ENTITY_SOUND, ENTITY_TELEPORT(NPacketPlayOutEntityTeleport::new), @@ -344,6 +347,7 @@ enum Server implements PacketType { MAP_CHUNK, MAP_CHUNK_BULK, MOUNT, + MOVE_MINECART_ALONG_TRACK, MULTI_BLOCK_CHANGE(NPacketPlayOutMultiBlockChange::new), NAMED_SOUND_EFFECT, NBT_QUERY, @@ -359,14 +363,20 @@ enum Server implements PacketType { POSITION(NPacketPlayOutPosition::new), PROJECTILE_POWER, RECIPES, + RECIPE_BOOK_ADD, + RECIPE_BOOK_REMOVE, + RECIPE_BOOK_SETTINGS, + RECIPE_PLACE_GHOST, RECIPE_UPDATE, REL_ENTITY_LOOK(NPacketPlayOutRelEntityLook::new), REL_ENTITY_MOVE(NPacketPlayOutRelEntityMove::new), REL_ENTITY_MOVE_LOOK(NPacketPlayOutRelEntityMoveLook::new), + REMOVE_ENTITIES, REMOVE_ENTITY_EFFECT, RESOURCE_PACK_POP, RESOURCE_PACK_SEND, RESPAWN, + ROTATION, SCOREBOARD_DISPLAY_OBJECTIVE, SCOREBOARD_OBJECTIVE, SCOREBOARD_RESET, @@ -376,19 +386,23 @@ enum Server implements PacketType { SERVER_DIFFICULTY, SERVER_LINKS, SELECT_ADVANCEMENT_TAB, - SET_DISPLAY_CHAT_PREVIEW, + SET_CHUNK_CACHE_CENTER, + SET_CHUNK_CACHE_RADIUS, + SET_CURSOR_ITEM, SET_COMPRESSION, SET_COOLDOWN, - SET_SLOT, + SET_DISPLAY_CHAT_PREVIEW, SET_ACTION_BAR_TEXT, SET_BORDER_CENTER, SET_BORDER_LERP_SIZE, SET_BORDER_SIZE, SET_BORDER_WARNING_DELAY, SET_BORDER_WARNING_DISTANCE, - SET_SUBTITLE_TEXT, + SET_PLAYER_INVENTORY, SET_TITLE_TEXT, SET_TITLE_ANIMATION, + SET_SUBTITLE_TEXT, + SET_SLOT, SIMULATION_DISTANCE, SPAWN_ENTITY, SPAWN_ENTITY_LIVING, @@ -402,7 +416,10 @@ enum Server implements PacketType { STOP_SOUND, SYSTEM_CHAT, TAB_COMPLETE, + TAB_LIST, TAGS, + TAG_UPDATE, + TAKE_ITEM_ENTITY, TICKING_STATE, TICKING_STEP, TILE_ENTITY_DATA, diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_13.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_13.java index f80dbc981..a148c1dd5 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_13.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_13.java @@ -15,7 +15,7 @@ public Version1_13() { for (Client type : Arrays.asList(Client.TELEPORT_ACCEPT, Client.TILE_NBT_QUERY, Client.CHAT, Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.PONG, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.KEEP_ALIVE, Client.FLYING, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, - Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, + Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14.java index a533bf9ad..3581235aa 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14.java @@ -16,7 +16,7 @@ public Version1_14() { Client.PONG, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.FLYING, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, - Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, + Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.USE_ITEM, Client.BLOCK_PLACE)) { playIn.put(i++, type); } diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14_4.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14_4.java index c643745df..1b8514e6a 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14_4.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_14_4.java @@ -16,7 +16,7 @@ public Version1_14_4() { Client.PONG, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.FLYING, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, - Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, + Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.USE_ITEM, Client.BLOCK_PLACE)) { playIn.put(i++, type); } diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_15.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_15.java index c7fe0b50c..8009efab5 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_15.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_15.java @@ -16,7 +16,7 @@ public Version1_15() { Client.PONG, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.FLYING, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, - Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, + Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); } diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_16.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_16.java index 997b4f10b..3d63ea62a 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_16.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_16.java @@ -16,7 +16,7 @@ public Version1_16() { Client.PONG, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.FLYING, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, - Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_17.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_17.java index 8462e5666..e97568b63 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_17.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_17.java @@ -16,7 +16,7 @@ public Version1_17() { Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, - Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_18.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_18.java index b4c5dd68e..dfebe3ea7 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_18.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_18.java @@ -15,7 +15,7 @@ public Version1_18() { Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, - Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19.java index 79ad6fbab..943b9aa33 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19.java @@ -19,7 +19,7 @@ public Version1_19() { Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, - Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_2.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_2.java index 39dde9956..daf337ea6 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_2.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_2.java @@ -15,7 +15,7 @@ public Version1_19_2() { Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, - Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, + Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_3.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_3.java index e854fa135..c4f82e5ca 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_3.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_3.java @@ -16,7 +16,7 @@ public Version1_19_3() { Client.SETTINGS, Client.TAB_COMPLETE, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, - Client.CHAT_SESSION_UPDATE, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, + Client.CHAT_SESSION_UPDATE, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_4.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_4.java index 7ad263e9a..cf7eab58e 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_4.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_19_4.java @@ -16,7 +16,7 @@ public Version1_19_4() { Client.CHAT_SESSION_UPDATE, Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, - Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, + Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20.java index 6075a3815..54355789a 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20.java @@ -17,7 +17,7 @@ public Version1_20() { Client.CHAT_SESSION_UPDATE, Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, - Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, + Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_2.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_2.java index f2ea22c03..89efbe934 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_2.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_2.java @@ -17,7 +17,7 @@ public Version1_20_2() { Client.CHAT_SESSION_UPDATE, Client.CHUNK_BATCH_RECEIVED, Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.CONFIGURATION_ACKNOWLEDGED, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, - Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, + Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_4.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_4.java index fb21ca719..bee437a50 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_4.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_4.java @@ -18,7 +18,7 @@ public Version1_20_4() { Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.SLOT_STATE_CHANGE, Client.CUSTOM_PAYLOAD, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, - Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.BLOCK_PLACE, Client.USE_ITEM)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_6.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_6.java index 23e5a39b4..3bc8ae6d3 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_6.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_20_6.java @@ -24,7 +24,7 @@ public Version1_20_6() { Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, - Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, + Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.USE_ITEM, Client.BLOCK_PLACE)) { playIn.put(i++, type); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21.java index 71218982a..a6f664ad7 100644 --- a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21.java +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21.java @@ -13,84 +13,52 @@ public Version1_21() { super("1.21"); // packets ID seems not same as 1.20 int i = 0; - for (Client type : Arrays.asList(Client.TELEPORT_ACCEPT, Client.TILE_NBT_QUERY, Client.DIFFICULTY_CHANGE, - Client.CHAT_ACK, Client.CHAT_COMMAND, Client.CHAT_COMMAND_SIGNED, Client.CHAT, - Client.CHAT_SESSION_UPDATE, Client.CHUNK_BATCH_RECEIVED, Client.CLIENT_COMMAND, Client.SETTINGS, - Client.TAB_COMPLETE, Client.CONFIGURATION_ACKNOWLEDGED, Client.ENCHANT_ITEM, Client.WINDOW_CLICK, - Client.CLOSE_WINDOW, Client.SLOT_STATE_CHANGE, Client.COOKIE_RESPONSE, Client.CUSTOM_PAYLOAD, - Client.DEBUG_SAMPLE_SUBSCRIPTION, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, - Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, - Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE, - Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, - Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS, - Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, - Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK, - Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, - Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.USE_ITEM, Client.BLOCK_PLACE)) { + for (Client type : Arrays.asList(Client.TELEPORT_ACCEPT, Client.TILE_NBT_QUERY, Client.DIFFICULTY_CHANGE, Client.CHAT_ACK, Client.CHAT_COMMAND, Client.CHAT_COMMAND_SIGNED, Client.CHAT, + Client.CHAT_SESSION_UPDATE, Client.CHUNK_BATCH_RECEIVED, Client.CLIENT_COMMAND, Client.SETTINGS, Client.TAB_COMPLETE, Client.CONFIGURATION_ACKNOWLEDGED, Client.ENCHANT_ITEM, + Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.SLOT_STATE_CHANGE, Client.COOKIE_RESPONSE, Client.CUSTOM_PAYLOAD, Client.DEBUG_SAMPLE_SUBSCRIPTION, Client.BEDIT, + Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, + Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, + Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, + Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, + Client.USE_ITEM, Client.BLOCK_PLACE)) { playIn.put(i++, type); } i = 0; - for (Server type : Arrays.asList(Server.BUNDLE, Server.SPAWN_ENTITY, Server.SPAWN_ENTITY_EXPERIENCE_ORB, - Server.ANIMATION, Server.STATISTIC, Server.BLOCK_CHANGED_ACK, Server.BLOCK_BREAK_ANIMATION, - Server.TILE_ENTITY_DATA, Server.BLOCK_ACTION, Server.BLOCK_CHANGE, Server.BOSS, - Server.SERVER_DIFFICULTY, Server.CHUNK_BATCH_FINISHED, Server.CHUNK_BATCH_STARTED, Server.CHUNK_BIOMES, - Server.CLEAR_TITLE, Server.TAB_COMPLETE, Server.COMMANDS, Server.CLOSE_WINDOW, Server.WINDOW_ITEMS, - Server.WINDOW_DATA, Server.SET_SLOT, Server.COOKIE_REQUEST, Server.SET_COOLDOWN, - Server.CHAT_CUSTOM_COMPLETION, Server.CUSTOM_PAYLOAD, Server.DAMAGE_EVENT, Server.DEBUG_SAMPLE, - Server.CHAT_DELETE, Server.KICK_DISCONNECT, Server.CHAT_DISGUISED, Server.ENTITY_STATUS, - Server.EXPLOSION, Server.UNLOAD_CHUNK, Server.GAME_STATE_CHANGE, Server.OPEN_WINDOW_HORSE, - Server.HURT_ANIMATION, Server.INITIALIZE_BORDER, Server.KEEP_ALIVE, Server.LEVEL_CHUNK_LIGHT, - Server.WORLD_EVENT, Server.WORLD_PARTICLES, Server.LIGHT_UPDATE, Server.LOGIN, Server.MAP, - Server.OPEN_WINDOW_MERCHANT, Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK, - Server.REL_ENTITY_LOOK, Server.VEHICLE_MOVE, Server.OPEN_BOOK, Server.OPEN_WINDOW, - Server.OPEN_SIGN_EDITOR, Server.PING, Server.PONG, Server.AUTO_RECIPE, Server.ABILITIES, Server.CHAT, - Server.COMBAT_END_EVENT, Server.COMBAT_ENTER_EVENT, Server.COMBAT_KILL_EVENT, Server.PLAYER_INFO_REMOVE, - Server.PLAYER_INFO_UPDATE, Server.LOOK_AT, Server.POSITION, Server.RECIPES, Server.ENTITY_DESTROY, - Server.REMOVE_ENTITY_EFFECT, Server.SCOREBOARD_RESET, Server.RESOURCE_PACK_POP, - Server.RESOURCE_PACK_SEND, Server.RESPAWN, Server.ENTITY_HEAD_ROTATION, Server.MULTI_BLOCK_CHANGE, - Server.SELECT_ADVANCEMENT_TAB, Server.SERVER_DATA, Server.SET_ACTION_BAR_TEXT, Server.SET_BORDER_CENTER, - Server.SET_BORDER_LERP_SIZE, Server.SET_BORDER_SIZE, Server.SET_BORDER_WARNING_DELAY, - Server.SET_BORDER_WARNING_DISTANCE, Server.CAMERA, Server.HELD_ITEM_SLOT, Server.VIEW_CENTRE, - Server.VIEW_DISTANCE, Server.SPAWN_POSITION, Server.SCOREBOARD_DISPLAY_OBJECTIVE, - Server.ENTITY_METADATA, Server.ATTACH_ENTITY, Server.ENTITY_VELOCITY, Server.ENTITY_EQUIPMENT, - Server.EXPERIENCE, Server.UPDATE_HEALTH, Server.SCOREBOARD_OBJECTIVE, Server.MOUNT, - Server.SCOREBOARD_TEAM, Server.SCOREBOARD_SCORE, Server.SIMULATION_DISTANCE, Server.SET_SUBTITLE_TEXT, - Server.UPDATE_TIME, Server.SET_TITLE_TEXT, Server.SET_TITLE_ANIMATION, Server.ENTITY_SOUND, - Server.NAMED_SOUND_EFFECT, Server.START_CONFIGURATION, Server.STOP_SOUND, Server.COOKIE_STORE, - Server.SYSTEM_CHAT, Server.PLAYER_LIST_HEADER_FOOTER, Server.NBT_QUERY, Server.COLLECT, - Server.ENTITY_TELEPORT, Server.TICKING_STATE, Server.TICKING_STEP, Server.TRANSFERT, - Server.ADVANCEMENTS, Server.UPDATE_ATTRIBUTES, Server.ENTITY_EFFECT, Server.RECIPE_UPDATE, Server.TAGS, - Server.PROJECTILE_POWER, Server.CUSTOM_REPORT_DETAILS, Server.SERVER_LINKS)) { + for (Server type : Arrays.asList(Server.BUNDLE, Server.SPAWN_ENTITY, Server.SPAWN_ENTITY_EXPERIENCE_ORB, Server.ANIMATION, Server.STATISTIC, Server.BLOCK_CHANGED_ACK, + Server.BLOCK_BREAK_ANIMATION, Server.TILE_ENTITY_DATA, Server.BLOCK_ACTION, Server.BLOCK_CHANGE, Server.BOSS, Server.SERVER_DIFFICULTY, Server.CHUNK_BATCH_FINISHED, + Server.CHUNK_BATCH_STARTED, Server.CHUNK_BIOMES, Server.CLEAR_TITLE, Server.TAB_COMPLETE, Server.COMMANDS, Server.CLOSE_WINDOW, Server.WINDOW_ITEMS, Server.WINDOW_DATA, + Server.SET_SLOT, Server.COOKIE_REQUEST, Server.SET_COOLDOWN, Server.CHAT_CUSTOM_COMPLETION, Server.CUSTOM_PAYLOAD, Server.DAMAGE_EVENT, Server.DEBUG_SAMPLE, Server.CHAT_DELETE, + Server.KICK_DISCONNECT, Server.CHAT_DISGUISED, Server.ENTITY_STATUS, Server.EXPLOSION, Server.UNLOAD_CHUNK, Server.GAME_STATE_CHANGE, Server.OPEN_WINDOW_HORSE, Server.HURT_ANIMATION, + Server.INITIALIZE_BORDER, Server.KEEP_ALIVE, Server.LEVEL_CHUNK_LIGHT, Server.WORLD_EVENT, Server.WORLD_PARTICLES, Server.LIGHT_UPDATE, Server.LOGIN, Server.MAP, + Server.OPEN_WINDOW_MERCHANT, Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK, Server.REL_ENTITY_LOOK, Server.VEHICLE_MOVE, Server.OPEN_BOOK, Server.OPEN_WINDOW, + Server.OPEN_SIGN_EDITOR, Server.PING, Server.PONG, Server.AUTO_RECIPE, Server.ABILITIES, Server.CHAT, Server.COMBAT_END_EVENT, Server.COMBAT_ENTER_EVENT, Server.COMBAT_KILL_EVENT, + Server.PLAYER_INFO_REMOVE, Server.PLAYER_INFO_UPDATE, Server.LOOK_AT, Server.POSITION, Server.RECIPES, Server.ENTITY_DESTROY, Server.REMOVE_ENTITY_EFFECT, Server.SCOREBOARD_RESET, + Server.RESOURCE_PACK_POP, Server.RESOURCE_PACK_SEND, Server.RESPAWN, Server.ENTITY_HEAD_ROTATION, Server.MULTI_BLOCK_CHANGE, Server.SELECT_ADVANCEMENT_TAB, Server.SERVER_DATA, + Server.SET_ACTION_BAR_TEXT, Server.SET_BORDER_CENTER, Server.SET_BORDER_LERP_SIZE, Server.SET_BORDER_SIZE, Server.SET_BORDER_WARNING_DELAY, Server.SET_BORDER_WARNING_DISTANCE, + Server.CAMERA, Server.HELD_ITEM_SLOT, Server.VIEW_CENTRE, Server.VIEW_DISTANCE, Server.SPAWN_POSITION, Server.SCOREBOARD_DISPLAY_OBJECTIVE, Server.ENTITY_METADATA, + Server.ATTACH_ENTITY, Server.ENTITY_VELOCITY, Server.ENTITY_EQUIPMENT, Server.EXPERIENCE, Server.UPDATE_HEALTH, Server.SCOREBOARD_OBJECTIVE, Server.MOUNT, Server.SCOREBOARD_TEAM, + Server.SCOREBOARD_SCORE, Server.SIMULATION_DISTANCE, Server.SET_SUBTITLE_TEXT, Server.UPDATE_TIME, Server.SET_TITLE_TEXT, Server.SET_TITLE_ANIMATION, Server.ENTITY_SOUND, + Server.NAMED_SOUND_EFFECT, Server.START_CONFIGURATION, Server.STOP_SOUND, Server.COOKIE_STORE, Server.SYSTEM_CHAT, Server.PLAYER_LIST_HEADER_FOOTER, Server.NBT_QUERY, Server.COLLECT, + Server.ENTITY_TELEPORT, Server.TICKING_STATE, Server.TICKING_STEP, Server.TRANSFERT, Server.ADVANCEMENTS, Server.UPDATE_ATTRIBUTES, Server.ENTITY_EFFECT, Server.RECIPE_UPDATE, + Server.TAGS, Server.PROJECTILE_POWER, Server.CUSTOM_REPORT_DETAILS, Server.SERVER_LINKS)) { playOut.put(i++, type); } i = 0; - for (EntityType types : Arrays.asList(EntityType.ALLAY, EntityType.AREA_EFFECT_CLOUD, EntityType.ARMOR_STAND, - EntityType.ARROW, EntityType.AXOLOTL, EntityType.BAT, EntityType.BEE, EntityType.BLAZE, EntityType.BOAT, - EntityType.CHEST_BOAT, EntityType.CAT, EntityType.CAVE_SPIDER, EntityType.CHICKEN, EntityType.COD, - EntityType.COW, EntityType.CREEPER, EntityType.DOLPHIN, EntityType.DONKEY, EntityType.DRAGON_FIREBALL, - EntityType.DROWNED, EntityType.ELDER_GUARDIAN, EntityType.ENDER_CRYSTAL, EntityType.ENDER_DRAGON, - EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.EVOKER, EntityType.EVOKER_FANGS, - EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, EntityType.FALLING_BLOCK, EntityType.FIREWORK, - EntityType.FOX, EntityType.FROG, EntityType.GHAST, EntityType.GIANT, EntityType.GLOW_ITEM_FRAME, - EntityType.GLOW_SQUID, EntityType.GOAT, EntityType.GUARDIAN, EntityType.HOGLIN, EntityType.HORSE, - EntityType.HUSK, EntityType.ILLUSIONER, EntityType.IRON_GOLEM, EntityType.DROPPED_ITEM, - EntityType.ITEM_FRAME, EntityType.FIREBALL, EntityType.LEASH_KNOT, EntityType.LIGHTNING, - EntityType.LLAMA, EntityType.LLAMA_SPIT, EntityType.MAGMA_CUBE, EntityType.MARKER, EntityType.MINECART, - EntityType.MINECART_CHEST, EntityType.MINECART_COMMAND_BLOCK, EntityType.MINECART_FURNACE, - EntityType.MINECART_HOPPER, EntityType.MINECART_MOB_SPAWNER, EntityType.MINECART_TNT, EntityType.MULE, - EntityType.MOOSHROOM, EntityType.OCELOT, EntityType.PAINTING, EntityType.PANDA, EntityType.PARROT, - EntityType.PHANTOM, EntityType.PIG, EntityType.PIGLIN, EntityType.PIGLIN_BRUTE, EntityType.PILLAGER, - EntityType.POLAR_BEAR, EntityType.PRIMED_TNT, EntityType.PUFFER_FISH, EntityType.RABBIT, - EntityType.RAVAGER, EntityType.SALMON, EntityType.SHEEP, EntityType.SHULKER, EntityType.SHULKER_BULLET, - EntityType.SILVERFISH, EntityType.SKELETON, EntityType.SKELETON_HORSE, EntityType.SLIME, - EntityType.SMALL_FIREBALL, EntityType.SNOW_GOLEM, EntityType.SNOW_BALL, EntityType.SPECTRAL_ARROW, - EntityType.SPIDER, EntityType.SQUID, EntityType.STRAY, EntityType.STRIDER, EntityType.TADPOLE, - EntityType.EGG, EntityType.ENDER_PEARL, EntityType.EXP_BOTTLE, EntityType.SPLASH_POTION, - EntityType.TRIDENT, EntityType.LLAMA_TRADER, EntityType.TROPICAL_FISH, EntityType.TURTLE, - EntityType.VEX, EntityType.VILLAGER, EntityType.VINDICATOR, EntityType.WANDERING_TRADER, - EntityType.WARDEN, EntityType.WITCH, EntityType.WITHER, EntityType.WITHER_SKELETON, - EntityType.WITHER_SKULL, EntityType.WOLF, EntityType.ZOGLIN, EntityType.ZOMBIE, - EntityType.ZOMBIE_VILLAGER, EntityType.PIG_ZOMBIE, EntityType.PLAYER, EntityType.FISHING_HOOK)) { + for (EntityType types : Arrays.asList(EntityType.ALLAY, EntityType.AREA_EFFECT_CLOUD, EntityType.ARMOR_STAND, EntityType.ARROW, EntityType.AXOLOTL, EntityType.BAT, EntityType.BEE, + EntityType.BLAZE, EntityType.BOAT, EntityType.CHEST_BOAT, EntityType.CAT, EntityType.CAVE_SPIDER, EntityType.CHICKEN, EntityType.COD, EntityType.COW, EntityType.CREEPER, + EntityType.DOLPHIN, EntityType.DONKEY, EntityType.DRAGON_FIREBALL, EntityType.DROWNED, EntityType.ELDER_GUARDIAN, EntityType.ENDER_CRYSTAL, EntityType.ENDER_DRAGON, + EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.EVOKER, EntityType.EVOKER_FANGS, EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, EntityType.FALLING_BLOCK, + EntityType.FIREWORK, EntityType.FOX, EntityType.FROG, EntityType.GHAST, EntityType.GIANT, EntityType.GLOW_ITEM_FRAME, EntityType.GLOW_SQUID, EntityType.GOAT, EntityType.GUARDIAN, + EntityType.HOGLIN, EntityType.HORSE, EntityType.HUSK, EntityType.ILLUSIONER, EntityType.IRON_GOLEM, EntityType.DROPPED_ITEM, EntityType.ITEM_FRAME, EntityType.FIREBALL, + EntityType.LEASH_KNOT, EntityType.LIGHTNING, EntityType.LLAMA, EntityType.LLAMA_SPIT, EntityType.MAGMA_CUBE, EntityType.MARKER, EntityType.MINECART, EntityType.MINECART_CHEST, + EntityType.MINECART_COMMAND_BLOCK, EntityType.MINECART_FURNACE, EntityType.MINECART_HOPPER, EntityType.MINECART_MOB_SPAWNER, EntityType.MINECART_TNT, EntityType.MULE, + EntityType.MOOSHROOM, EntityType.OCELOT, EntityType.PAINTING, EntityType.PANDA, EntityType.PARROT, EntityType.PHANTOM, EntityType.PIG, EntityType.PIGLIN, EntityType.PIGLIN_BRUTE, + EntityType.PILLAGER, EntityType.POLAR_BEAR, EntityType.PRIMED_TNT, EntityType.PUFFER_FISH, EntityType.RABBIT, EntityType.RAVAGER, EntityType.SALMON, EntityType.SHEEP, + EntityType.SHULKER, EntityType.SHULKER_BULLET, EntityType.SILVERFISH, EntityType.SKELETON, EntityType.SKELETON_HORSE, EntityType.SLIME, EntityType.SMALL_FIREBALL, + EntityType.SNOW_GOLEM, EntityType.SNOW_BALL, EntityType.SPECTRAL_ARROW, EntityType.SPIDER, EntityType.SQUID, EntityType.STRAY, EntityType.STRIDER, EntityType.TADPOLE, EntityType.EGG, + EntityType.ENDER_PEARL, EntityType.EXP_BOTTLE, EntityType.SPLASH_POTION, EntityType.TRIDENT, EntityType.LLAMA_TRADER, EntityType.TROPICAL_FISH, EntityType.TURTLE, EntityType.VEX, + EntityType.VILLAGER, EntityType.VINDICATOR, EntityType.WANDERING_TRADER, EntityType.WARDEN, EntityType.WITCH, EntityType.WITHER, EntityType.WITHER_SKELETON, EntityType.WITHER_SKULL, + EntityType.WOLF, EntityType.ZOGLIN, EntityType.ZOMBIE, EntityType.ZOMBIE_VILLAGER, EntityType.PIG_ZOMBIE, EntityType.PLAYER, EntityType.FISHING_HOOK)) { entityTypes.put(i++, types); } loadPostFlattening("/versions/v1_20_6/"); diff --git a/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21_3.java b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21_3.java new file mode 100644 index 000000000..4a4a90c7a --- /dev/null +++ b/common/src/com/elikill58/negativity/api/packets/nms/versions/Version1_21_3.java @@ -0,0 +1,68 @@ +package com.elikill58.negativity.api.packets.nms.versions; + +import java.util.Arrays; + +import com.elikill58.negativity.api.entity.EntityType; +import com.elikill58.negativity.api.packets.PacketType.Client; +import com.elikill58.negativity.api.packets.PacketType.Server; +import com.elikill58.negativity.api.packets.nms.NamedVersion; + +public class Version1_21_3 extends NamedVersion { + + public Version1_21_3() { + super("1.21.3"); + int i = 0; + for (Client type : Arrays.asList(Client.TELEPORT_ACCEPT, Client.TILE_NBT_QUERY, Client.BUNDLE_ITEM_SELECTED, Client.DIFFICULTY_CHANGE, Client.CHAT_ACK, Client.CHAT_COMMAND, Client.CHAT_COMMAND_SIGNED, Client.CHAT, + Client.CHAT_SESSION_UPDATE, Client.CHUNK_BATCH_RECEIVED, Client.CLIENT_COMMAND, Client.TICK_END, Client.SETTINGS, Client.TAB_COMPLETE, Client.CONFIGURATION_ACKNOWLEDGED, Client.ENCHANT_ITEM, + Client.WINDOW_CLICK, Client.CLOSE_WINDOW, Client.SLOT_STATE_CHANGE, Client.COOKIE_RESPONSE, Client.CUSTOM_PAYLOAD, Client.DEBUG_SAMPLE_SUBSCRIPTION, Client.BEDIT, + Client.ENTITY_NBT_QUERY, Client.USE_ENTITY, Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION, Client.POSITION_LOOK, Client.LOOK, Client.GROUND, + Client.VEHICLE_MOVE, Client.BOAT_MOVE, Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG, Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, + Client.RECIPE_SETTINGS, Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS, Client.TRADE_SELECT, Client.BEACON, Client.HELD_ITEM_SLOT, + Client.SET_COMMAND_BLOCK, Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT, Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, + Client.USE_ITEM, Client.BLOCK_PLACE)) { + playIn.put(i++, type); + } + i = 0; + for (Server type : Arrays.asList(Server.BUNDLE, Server.SPAWN_ENTITY, Server.SPAWN_ENTITY_EXPERIENCE_ORB, Server.ANIMATION, Server.STATISTIC, Server.BLOCK_CHANGED_ACK, + Server.BLOCK_BREAK_ANIMATION, Server.TILE_ENTITY_DATA, Server.BLOCK_ACTION, Server.BLOCK_CHANGE, Server.BOSS, Server.SERVER_DIFFICULTY, Server.CHUNK_BATCH_FINISHED, + Server.CHUNK_BATCH_STARTED, Server.CHUNK_BIOMES, Server.CLEAR_TITLE, Server.TAB_COMPLETE, Server.COMMANDS, Server.CLOSE_WINDOW, Server.WINDOW_ITEMS, Server.WINDOW_DATA, + Server.SET_SLOT, Server.COOKIE_REQUEST, Server.SET_COOLDOWN, Server.CHAT_CUSTOM_COMPLETION, Server.CUSTOM_PAYLOAD, Server.DAMAGE_EVENT, Server.DEBUG_SAMPLE, Server.CHAT_DELETE, + Server.KICK_DISCONNECT, Server.CHAT_DISGUISED, Server.ENTITY_STATUS, Server.ENTITY_POSITION_SYNC, Server.EXPLOSION, Server.UNLOAD_CHUNK, Server.GAME_STATE_CHANGE, Server.OPEN_WINDOW_HORSE, + Server.HURT_ANIMATION, Server.INITIALIZE_BORDER, Server.KEEP_ALIVE, Server.LEVEL_CHUNK_LIGHT, Server.WORLD_EVENT, Server.WORLD_PARTICLES, Server.LIGHT_UPDATE, Server.LOGIN, Server.MAP, + Server.OPEN_WINDOW_MERCHANT, Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK, Server.MOVE_MINECART_ALONG_TRACK, Server.REL_ENTITY_LOOK, Server.VEHICLE_MOVE, Server.OPEN_BOOK, + Server.OPEN_WINDOW, Server.OPEN_SIGN_EDITOR, Server.PING, Server.PONG, Server.RECIPE_PLACE_GHOST, Server.ABILITIES, Server.CHAT, Server.COMBAT_END_EVENT, Server.COMBAT_ENTER_EVENT, + Server.COMBAT_KILL_EVENT, Server.PLAYER_INFO_REMOVE, Server.PLAYER_INFO_UPDATE, Server.LOOK_AT, Server.POSITION, Server.ROTATION, Server.RECIPE_BOOK_ADD, + Server.RECIPE_BOOK_REMOVE, Server.RECIPE_BOOK_SETTINGS, Server.REMOVE_ENTITIES, Server.REMOVE_ENTITY_EFFECT, Server.SCOREBOARD_RESET, Server.RESOURCE_PACK_POP, Server.RESOURCE_PACK_SEND, + Server.RESPAWN, Server.ENTITY_HEAD_ROTATION, Server.MULTI_BLOCK_CHANGE, Server.SELECT_ADVANCEMENT_TAB, Server.SERVER_DATA, Server.SET_ACTION_BAR_TEXT, Server.SET_BORDER_CENTER, + Server.SET_BORDER_LERP_SIZE, Server.SET_BORDER_SIZE, Server.SET_BORDER_WARNING_DELAY, Server.SET_BORDER_WARNING_DISTANCE, Server.CAMERA, Server.SET_CHUNK_CACHE_CENTER, + Server.SET_CHUNK_CACHE_RADIUS, Server.SET_CURSOR_ITEM, Server.SPAWN_POSITION, Server.SCOREBOARD_DISPLAY_OBJECTIVE, Server.ENTITY_METADATA, Server.ATTACH_ENTITY, + Server.ENTITY_VELOCITY, Server.ENTITY_EQUIPMENT, Server.EXPERIENCE, Server.UPDATE_HEALTH, Server.HELD_ITEM_SLOT, Server.SCOREBOARD_OBJECTIVE, Server.MOUNT, Server.SET_PLAYER_INVENTORY, + Server.SCOREBOARD_TEAM, Server.SCOREBOARD_SCORE, Server.SIMULATION_DISTANCE, Server.SET_SUBTITLE_TEXT, Server.UPDATE_TIME, Server.SET_TITLE_TEXT, Server.SET_TITLE_ANIMATION, + Server.ENTITY_SOUND, Server.NAMED_SOUND_EFFECT, Server.START_CONFIGURATION, Server.STOP_SOUND, Server.COOKIE_STORE, Server.SYSTEM_CHAT, Server.TAB_LIST, Server.TAGS, + Server.TAKE_ITEM_ENTITY, Server.ENTITY_TELEPORT, Server.TICKING_STATE, Server.TICKING_STEP, Server.TRANSFERT, Server.ADVANCEMENTS, Server.UPDATE_ATTRIBUTES, Server.ENTITY_EFFECT, + Server.RECIPE_UPDATE, Server.TAG_UPDATE, Server.PROJECTILE_POWER, Server.CUSTOM_REPORT_DETAILS, Server.SERVER_LINKS)) { + playOut.put(i++, type); + } + i = 0; + for (EntityType types : Arrays.asList(EntityType.ALLAY, EntityType.AREA_EFFECT_CLOUD, EntityType.ARMOR_STAND, EntityType.ARROW, EntityType.AXOLOTL, EntityType.BAT, EntityType.BEE, + EntityType.BLAZE, EntityType.BOAT, EntityType.CHEST_BOAT, EntityType.CAT, EntityType.CAVE_SPIDER, EntityType.CHICKEN, EntityType.COD, EntityType.COW, EntityType.CREEPER, + EntityType.DOLPHIN, EntityType.DONKEY, EntityType.DRAGON_FIREBALL, EntityType.DROWNED, EntityType.ELDER_GUARDIAN, EntityType.ENDER_CRYSTAL, EntityType.ENDER_DRAGON, + EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.EVOKER, EntityType.EVOKER_FANGS, EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, EntityType.FALLING_BLOCK, + EntityType.FIREWORK, EntityType.FOX, EntityType.FROG, EntityType.GHAST, EntityType.GIANT, EntityType.GLOW_ITEM_FRAME, EntityType.GLOW_SQUID, EntityType.GOAT, EntityType.GUARDIAN, + EntityType.HOGLIN, EntityType.HORSE, EntityType.HUSK, EntityType.ILLUSIONER, EntityType.IRON_GOLEM, EntityType.DROPPED_ITEM, EntityType.ITEM_FRAME, EntityType.FIREBALL, + EntityType.LEASH_KNOT, EntityType.LIGHTNING, EntityType.LLAMA, EntityType.LLAMA_SPIT, EntityType.MAGMA_CUBE, EntityType.MARKER, EntityType.MINECART, EntityType.MINECART_CHEST, + EntityType.MINECART_COMMAND_BLOCK, EntityType.MINECART_FURNACE, EntityType.MINECART_HOPPER, EntityType.MINECART_MOB_SPAWNER, EntityType.MINECART_TNT, EntityType.MULE, + EntityType.MOOSHROOM, EntityType.OCELOT, EntityType.PAINTING, EntityType.PANDA, EntityType.PARROT, EntityType.PHANTOM, EntityType.PIG, EntityType.PIGLIN, EntityType.PIGLIN_BRUTE, + EntityType.PILLAGER, EntityType.POLAR_BEAR, EntityType.PRIMED_TNT, EntityType.PUFFER_FISH, EntityType.RABBIT, EntityType.RAVAGER, EntityType.SALMON, EntityType.SHEEP, + EntityType.SHULKER, EntityType.SHULKER_BULLET, EntityType.SILVERFISH, EntityType.SKELETON, EntityType.SKELETON_HORSE, EntityType.SLIME, EntityType.SMALL_FIREBALL, + EntityType.SNOW_GOLEM, EntityType.SNOW_BALL, EntityType.SPECTRAL_ARROW, EntityType.SPIDER, EntityType.SQUID, EntityType.STRAY, EntityType.STRIDER, EntityType.TADPOLE, EntityType.EGG, + EntityType.ENDER_PEARL, EntityType.EXP_BOTTLE, EntityType.SPLASH_POTION, EntityType.TRIDENT, EntityType.LLAMA_TRADER, EntityType.TROPICAL_FISH, EntityType.TURTLE, EntityType.VEX, + EntityType.VILLAGER, EntityType.VINDICATOR, EntityType.WANDERING_TRADER, EntityType.WARDEN, EntityType.WITCH, EntityType.WITHER, EntityType.WITHER_SKELETON, EntityType.WITHER_SKULL, + EntityType.WOLF, EntityType.ZOGLIN, EntityType.ZOMBIE, EntityType.ZOMBIE_VILLAGER, EntityType.PIG_ZOMBIE, EntityType.PLAYER, EntityType.FISHING_HOOK)) { + entityTypes.put(i++, types); + } + loadPostFlattening("/versions/v1_20_6/"); + + log(); + } +} diff --git a/common/src/com/elikill58/negativity/api/packets/packet/playin/NPacketPlayInSteerVehicle.java b/common/src/com/elikill58/negativity/api/packets/packet/playin/NPacketPlayInSteerVehicle.java index 5204dc737..d800a6a22 100644 --- a/common/src/com/elikill58/negativity/api/packets/packet/playin/NPacketPlayInSteerVehicle.java +++ b/common/src/com/elikill58/negativity/api/packets/packet/playin/NPacketPlayInSteerVehicle.java @@ -7,6 +7,8 @@ public class NPacketPlayInSteerVehicle implements NPacketPlayIn { + private static final float IMPULSE = 0.98F; + public float sideways = 0, forward = 0; public boolean jumping = false, sneaking = false; @@ -23,11 +25,36 @@ public NPacketPlayInSteerVehicle(float sideways, float forward, boolean jumping, @Override public void read(PacketSerializer serializer, Version version) { - this.sideways = serializer.readFloat(); - this.forward = serializer.readFloat(); - byte b = serializer.readByte(); - this.jumping = ((b & 0x1) > 0); - this.sneaking = ((b & 0x2) > 0); + if(version.isNewerOrEquals(Version.V1_21)) { + + byte flags = serializer.readByte(); + boolean left = (flags & 1 << 2) != 0; + boolean right = (flags & 1 << 3) != 0; + sideways = left ? IMPULSE : (right ? -IMPULSE : 0F); + + boolean forwards = (flags & 1 << 0) != 0; + boolean backward = (flags & 1 << 1) != 0; + forward = forwards ? IMPULSE : (backward ? -IMPULSE : 0F); + + byte updatedFlags = 0; + // firstly convert content to actual data + if ((flags & 1 << 4) != 0) { + updatedFlags |= 1; + } + if ((flags & 1 << 5) != 0) { + updatedFlags |= 2; + } + // then get them back + this.jumping = ((updatedFlags & 0x1) > 0); + this.sneaking = ((updatedFlags & 0x2) > 0); + // maybe this can be simplified ? + } else { + this.sideways = serializer.readFloat(); + this.forward = serializer.readFloat(); + byte b = serializer.readByte(); + this.jumping = ((b & 0x1) > 0); + this.sneaking = ((b & 0x2) > 0); + } } @Override diff --git a/common/src/com/elikill58/negativity/universal/Version.java b/common/src/com/elikill58/negativity/universal/Version.java index b53da4208..e3383a5fb 100644 --- a/common/src/com/elikill58/negativity/universal/Version.java +++ b/common/src/com/elikill58/negativity/universal/Version.java @@ -24,6 +24,7 @@ import com.elikill58.negativity.api.packets.nms.versions.Version1_20_4; import com.elikill58.negativity.api.packets.nms.versions.Version1_20_6; import com.elikill58.negativity.api.packets.nms.versions.Version1_21; +import com.elikill58.negativity.api.packets.nms.versions.Version1_21_3; import com.elikill58.negativity.api.packets.nms.versions.Version1_8; import com.elikill58.negativity.api.packets.nms.versions.Version1_9; import com.elikill58.negativity.api.packets.nms.versions.VersionUnknown; @@ -52,7 +53,8 @@ public enum Version { V1_20_2("1.20.2", 20.2, Version1_20_2::new, 764), V1_20_4("1.20.4", 20.4, Version1_20_4::new, 765), V1_20_6("1.20.6", 20.5, Version1_20_6::new, 766), - V1_21("1.21", 21, Version1_21::new, 767, 999), + V1_21("1.21", 21, Version1_21::new, 767), + V1_21_3("1.21.3", 21.3, Version1_21_3::new, 768, 999), HIGHER("higher", 42, VersionUnknown::new, 1000); private final double power; diff --git a/common/src/com/elikill58/negativity/universal/translation/NegativityTranslationProviderFactory.java b/common/src/com/elikill58/negativity/universal/translation/NegativityTranslationProviderFactory.java index 3e4c856da..536819a7b 100644 --- a/common/src/com/elikill58/negativity/universal/translation/NegativityTranslationProviderFactory.java +++ b/common/src/com/elikill58/negativity/universal/translation/NegativityTranslationProviderFactory.java @@ -41,7 +41,7 @@ public TranslationProvider createTranslationProvider(String language) { continue; } - for (String line : Files.readAllLines(file, StandardCharsets.UTF_8)) { + for (String line : Files.readAllLines(file, StandardCharsets.ISO_8859_1)) { concatenatedBundles.append(line); // Make sure we have a new line between concatenated files concatenatedBundles.append(System.lineSeparator()); diff --git a/spigot/src/com/elikill58/negativity/spigot/SpigotAdapter.java b/spigot/src/com/elikill58/negativity/spigot/SpigotAdapter.java index 02ff23a3d..cdb2d6796 100644 --- a/spigot/src/com/elikill58/negativity/spigot/SpigotAdapter.java +++ b/spigot/src/com/elikill58/negativity/spigot/SpigotAdapter.java @@ -6,6 +6,8 @@ import java.util.List; import java.util.UUID; import java.util.function.BiConsumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.bukkit.Bukkit; @@ -58,10 +60,22 @@ public class SpigotAdapter extends Adapter { private final LoggerAdapter logger; private final SpigotItemRegistrar itemRegistrar; private final Scheduler scheduler; + private String version; private Configuration config; public SpigotAdapter(JavaPlugin pl) { this.pl = pl; + String REGEX = "MC: (\\d+\\.\\d+(\\.\\d+)?)"; + + version = Utils.getInternalVersion(); + if(version.equalsIgnoreCase("")) { + try { + Matcher matcher = Pattern.compile(REGEX).matcher(Bukkit.getVersion()); + if (matcher.find()) { + version = "v" + matcher.group(1).replace(".", "_"); + } + } catch (IllegalArgumentException ignored){} + } this.config = UniversalUtils.loadConfig(new File(pl.getDataFolder(), "config.yml"), "config.yml"); this.translationProviderFactory = new NegativityTranslationProviderFactory( pl.getDataFolder().toPath().resolve("lang"), "Negativity", "CheatHover"); @@ -97,17 +111,10 @@ public void reload() { @Override public String getVersion() { - String[] parts = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(","); + /*String[] parts = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(","); if(parts.length > 3) - return parts[3]; - /*try { - Object mcVersion = Bukkit.class.getDeclaredMethod("getMinecraftVersion").invoke(null); - return mcVersion.toString().replace(".", "_"); - } catch (Exception e) { - getLogger().warn("Failed to get minecraft version"); - e.printStackTrace(); - }*/ - return ""; + return parts[3];*/ + return version; } @Override diff --git a/spigot/src/com/elikill58/negativity/spigot/nms/SpigotVersionAdapter.java b/spigot/src/com/elikill58/negativity/spigot/nms/SpigotVersionAdapter.java index 4ca657802..7db490e22 100644 --- a/spigot/src/com/elikill58/negativity/spigot/nms/SpigotVersionAdapter.java +++ b/spigot/src/com/elikill58/negativity/spigot/nms/SpigotVersionAdapter.java @@ -48,14 +48,15 @@ public SpigotVersionAdapter(int protocolVersion) { getPlayerHandle = PacketUtils.getObcClass("entity.CraftPlayer").getDeclaredMethod("getHandle"); - Class entityPlayerClass = PacketUtils.getNmsClass(SubPlatform.getSubPlatform().equals(SubPlatform.FOLIA) ? "ServerPlayer" : "EntityPlayer", "server.level."); - if (version.isNewerOrEquals(Version.V1_20)) { - playerConnectionField = entityPlayerClass.getDeclaredField(SubPlatform.getSubPlatform().equals(SubPlatform.FOLIA) ? "connection" : "c"); - } else if (version.isNewerOrEquals(Version.V1_17)) { + Class entityPlayerClass = PacketUtils.getNmsClass("EntityPlayer", "server.level."); + if(SubPlatform.getSubPlatform().equals(SubPlatform.FOLIA) || version.isNewerOrEquals(Version.V1_21_3)) { + playerConnectionField = PacketUtils.getNmsClass("ServerPlayer", "server.level.").getDeclaredField("connection"); + } else if (version.isNewerOrEquals(Version.V1_20)) + playerConnectionField = entityPlayerClass.getDeclaredField("c"); + else if (version.isNewerOrEquals(Version.V1_17)) playerConnectionField = entityPlayerClass.getDeclaredField("b"); - } else { + else playerConnectionField = entityPlayerClass.getDeclaredField("playerConnection"); - } Class bbClass = PacketUtils.getNmsClass(SubPlatform.getSubPlatform().equals(SubPlatform.FOLIA) ? "AABB" : "AxisAlignedBB", "world.phys."); if (version.isNewerOrEquals(Version.V1_13) && hasMinField(bbClass)) { @@ -323,7 +324,9 @@ public static SpigotVersionAdapter getVersionAdapter() { return instance = new Spigot_1_20_R3(); case "v1_20_R4": return instance = new Spigot_1_20_R4(); - case "": // 1.20.6 or upper + case "v1_20_6": // 1.20.6 or upper + case "v1_21_1": + case "v1_21_3": return instance = new Spigot_1_21_R1(); default: return instance = new Spigot_UnknowVersion(Adapter.getAdapter().getVersion()); diff --git a/spigot/src/com/elikill58/negativity/spigot/nms/Spigot_1_21_R1.java b/spigot/src/com/elikill58/negativity/spigot/nms/Spigot_1_21_R1.java index 3065931d5..f2d705813 100644 --- a/spigot/src/com/elikill58/negativity/spigot/nms/Spigot_1_21_R1.java +++ b/spigot/src/com/elikill58/negativity/spigot/nms/Spigot_1_21_R1.java @@ -1,6 +1,5 @@ package com.elikill58.negativity.spigot.nms; -import com.elikill58.negativity.spigot.SubPlatform; import com.elikill58.negativity.spigot.utils.PacketUtils; public class Spigot_1_21_R1 extends SpigotVersionAdapter { @@ -11,6 +10,6 @@ public Spigot_1_21_R1() { @Override public String getTpsFieldName() { - return SubPlatform.getSubPlatform().equals(SubPlatform.FOLIA) ? "tickTimesNanos" : "ab"; + return "tickTimesNanos"; } } diff --git a/spigot/src/com/elikill58/negativity/spigot/utils/PacketUtils.java b/spigot/src/com/elikill58/negativity/spigot/utils/PacketUtils.java index 4f4cad794..b31b6005e 100644 --- a/spigot/src/com/elikill58/negativity/spigot/utils/PacketUtils.java +++ b/spigot/src/com/elikill58/negativity/spigot/utils/PacketUtils.java @@ -25,7 +25,7 @@ public class PacketUtils { private static boolean isNewSystem() { try { - Class.forName("net.minecraft.server." + Adapter.getAdapter().getVersion() + ".MinecraftServer"); + Class.forName("net.minecraft.server." + Utils.getInternalVersion() + ".MinecraftServer"); return false; } catch (Exception e) { } @@ -84,7 +84,7 @@ public static Class getObcClass(String name) { synchronized (ALL_CLASS) { return ALL_CLASS.computeIfAbsent(name, (s) -> { try { - String version = Adapter.getAdapter().getVersion(); + String version = Utils.getInternalVersion(); return Class.forName("org.bukkit.craftbukkit." + (version.equalsIgnoreCase("") ? "" : version + ".") + name); } catch (Exception e) { e.printStackTrace(); diff --git a/spigot/src/com/elikill58/negativity/spigot/utils/Utils.java b/spigot/src/com/elikill58/negativity/spigot/utils/Utils.java index 395952387..017c6f6e7 100644 --- a/spigot/src/com/elikill58/negativity/spigot/utils/Utils.java +++ b/spigot/src/com/elikill58/negativity/spigot/utils/Utils.java @@ -22,6 +22,11 @@ @SuppressWarnings("deprecation") public class Utils { + + public static String getInternalVersion() { + String[] parts = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(","); + return parts.length > 3 ? parts[3] : ""; + } public static List getOnlinePlayers() { return SpigotVersionAdapter.getVersionAdapter().getOnlinePlayers();