Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
23w03a
Dieser Commit ist enthalten in:
Ursprung
7d0b838474
Commit
50adff90f2
@ -83,6 +83,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
||||||
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
||||||
public static final ProtocolVersion v1_19_3 = register(761, "1.19.3");
|
public static final ProtocolVersion v1_19_3 = register(761, "1.19.3");
|
||||||
|
public static final ProtocolVersion v1_19_4 = register(762, 115, "1.19.4");
|
||||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||||
|
|
||||||
public static ProtocolVersion register(int version, String name) {
|
public static ProtocolVersion register(int version, String name) {
|
||||||
|
@ -67,8 +67,9 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_
|
|||||||
import com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18;
|
import com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1;
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2;
|
||||||
@ -172,13 +173,14 @@ public class ProtocolManagerImpl implements ProtocolManager {
|
|||||||
|
|
||||||
registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
|
registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
|
||||||
registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
|
registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
|
||||||
|
|
||||||
registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
|
registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
|
||||||
registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18);
|
registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18);
|
||||||
|
|
||||||
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18_2);
|
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18_2);
|
||||||
registerProtocol(new Protocol1_19_1To1_19(), ProtocolVersion.v1_19_1, ProtocolVersion.v1_19);
|
registerProtocol(new Protocol1_19_1To1_19(), ProtocolVersion.v1_19_1, ProtocolVersion.v1_19);
|
||||||
|
|
||||||
registerProtocol(new Protocol1_19_3To1_19_1(), ProtocolVersion.v1_19_3, ProtocolVersion.v1_19_1);
|
registerProtocol(new Protocol1_19_3To1_19_1(), ProtocolVersion.v1_19_3, ProtocolVersion.v1_19_1);
|
||||||
|
registerProtocol(new Protocol1_19_4To1_19_3(), ProtocolVersion.v1_19_4, ProtocolVersion.v1_19_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2023 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
|
|
||||||
|
public enum ClientboundPackets1_19_4 implements ClientboundPacketType {
|
||||||
|
|
||||||
|
BUNDLE, // 0x00
|
||||||
|
SPAWN_ENTITY, // 0x01
|
||||||
|
SPAWN_EXPERIENCE_ORB, // 0x02
|
||||||
|
SPAWN_PLAYER, // 0x03
|
||||||
|
ENTITY_ANIMATION, // 0x04
|
||||||
|
STATISTICS, // 0x05
|
||||||
|
BLOCK_CHANGED_ACK, // 0x06
|
||||||
|
BLOCK_BREAK_ANIMATION, // 0x07
|
||||||
|
BLOCK_ENTITY_DATA, // 0x08
|
||||||
|
BLOCK_ACTION, // 0x09
|
||||||
|
BLOCK_CHANGE, // 0x0A
|
||||||
|
BOSSBAR, // 0x0B
|
||||||
|
SERVER_DIFFICULTY, // 0x0C
|
||||||
|
CLEAR_TITLES, // 0x0D
|
||||||
|
TAB_COMPLETE, // 0x0E
|
||||||
|
DECLARE_COMMANDS, // 0x0F
|
||||||
|
CLOSE_WINDOW, // 0x10
|
||||||
|
WINDOW_ITEMS, // 0x11
|
||||||
|
WINDOW_PROPERTY, // 0x12
|
||||||
|
SET_SLOT, // 0x13
|
||||||
|
COOLDOWN, // 0x14
|
||||||
|
CUSTOM_CHAT_COMPLETIONS, // 0x15
|
||||||
|
PLUGIN_MESSAGE, // 0x16
|
||||||
|
DELETE_CHAT_MESSAGE, // 0x17
|
||||||
|
DISCONNECT, // 0x18
|
||||||
|
DISGUISED_CHAT, // 0x19
|
||||||
|
ENTITY_STATUS, // 0x1A
|
||||||
|
EXPLOSION, // 0x1B
|
||||||
|
UNLOAD_CHUNK, // 0x1C
|
||||||
|
GAME_EVENT, // 0x1D
|
||||||
|
OPEN_HORSE_WINDOW, // 0x1E
|
||||||
|
HIT_ANIMATION, // 0x1F
|
||||||
|
WORLD_BORDER_INIT, // 0x20
|
||||||
|
KEEP_ALIVE, // 0x21
|
||||||
|
CHUNK_DATA, // 0x22
|
||||||
|
EFFECT, // 0x23
|
||||||
|
SPAWN_PARTICLE, // 0x24
|
||||||
|
UPDATE_LIGHT, // 0x25
|
||||||
|
JOIN_GAME, // 0x26
|
||||||
|
MAP_DATA, // 0x27
|
||||||
|
TRADE_LIST, // 0x28
|
||||||
|
ENTITY_POSITION, // 0x29
|
||||||
|
ENTITY_POSITION_AND_ROTATION, // 0x2A
|
||||||
|
ENTITY_ROTATION, // 0x2B
|
||||||
|
VEHICLE_MOVE, // 0x2C
|
||||||
|
OPEN_BOOK, // 0x2D
|
||||||
|
OPEN_WINDOW, // 0x2E
|
||||||
|
OPEN_SIGN_EDITOR, // 0x2F
|
||||||
|
PING, // 0x30
|
||||||
|
CRAFT_RECIPE_RESPONSE, // 0x31
|
||||||
|
PLAYER_ABILITIES, // 0x32
|
||||||
|
PLAYER_CHAT, // 0x33
|
||||||
|
COMBAT_END, // 0x34
|
||||||
|
COMBAT_ENTER, // 0x35
|
||||||
|
COMBAT_KILL, // 0x36
|
||||||
|
PLAYER_INFO_REMOVE, // 0x37
|
||||||
|
PLAYER_INFO_UPDATE, // 0x38
|
||||||
|
FACE_PLAYER, // 0x39
|
||||||
|
PLAYER_POSITION, // 0x3A
|
||||||
|
UNLOCK_RECIPES, // 0x3B
|
||||||
|
REMOVE_ENTITIES, // 0x3C
|
||||||
|
REMOVE_ENTITY_EFFECT, // 0x3D
|
||||||
|
RESOURCE_PACK, // 0x3E
|
||||||
|
RESPAWN, // 0x3F
|
||||||
|
ENTITY_HEAD_LOOK, // 0x40
|
||||||
|
MULTI_BLOCK_CHANGE, // 0x41
|
||||||
|
SELECT_ADVANCEMENTS_TAB, // 0x42
|
||||||
|
SERVER_DATA, // 0x43
|
||||||
|
ACTIONBAR, // 0x44
|
||||||
|
WORLD_BORDER_CENTER, // 0x45
|
||||||
|
WORLD_BORDER_LERP_SIZE, // 0x46
|
||||||
|
WORLD_BORDER_SIZE, // 0x47
|
||||||
|
WORLD_BORDER_WARNING_DELAY, // 0x48
|
||||||
|
WORLD_BORDER_WARNING_DISTANCE, // 0x49
|
||||||
|
CAMERA, // 0x4A
|
||||||
|
HELD_ITEM_CHANGE, // 0x4B
|
||||||
|
UPDATE_VIEW_POSITION, // 0x4C
|
||||||
|
UPDATE_VIEW_DISTANCE, // 0x4D
|
||||||
|
SPAWN_POSITION, // 0x4E
|
||||||
|
DISPLAY_SCOREBOARD, // 0x4F
|
||||||
|
ENTITY_METADATA, // 0x50
|
||||||
|
ATTACH_ENTITY, // 0x51
|
||||||
|
ENTITY_VELOCITY, // 0x52
|
||||||
|
ENTITY_EQUIPMENT, // 0x53
|
||||||
|
SET_EXPERIENCE, // 0x54
|
||||||
|
UPDATE_HEALTH, // 0x55
|
||||||
|
SCOREBOARD_OBJECTIVE, // 0x56
|
||||||
|
SET_PASSENGERS, // 0x57
|
||||||
|
TEAMS, // 0x58
|
||||||
|
UPDATE_SCORE, // 0x59
|
||||||
|
SET_SIMULATION_DISTANCE, // 0x5A
|
||||||
|
TITLE_SUBTITLE, // 0x5B
|
||||||
|
TIME_UPDATE, // 0x5C
|
||||||
|
TITLE_TEXT, // 0x5D
|
||||||
|
TITLE_TIMES, // 0x5E
|
||||||
|
ENTITY_SOUND, // 0x5F
|
||||||
|
SOUND, // 0x60
|
||||||
|
STOP_SOUND, // 0x61
|
||||||
|
SYSTEM_CHAT, // 0x62
|
||||||
|
TAB_LIST, // 0x63
|
||||||
|
NBT_QUERY, // 0x64
|
||||||
|
COLLECT_ITEM, // 0x65
|
||||||
|
ENTITY_TELEPORT, // 0x66
|
||||||
|
ADVANCEMENTS, // 0x67
|
||||||
|
ENTITY_PROPERTIES, // 0x68
|
||||||
|
UPDATE_ENABLED_FEATURES, // 0x69
|
||||||
|
ENTITY_EFFECT, // 0x6A
|
||||||
|
DECLARE_RECIPES, // 0x6B
|
||||||
|
TAGS; // 0x6C
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2023 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
|
import com.viaversion.viaversion.api.data.MappingData;
|
||||||
|
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
||||||
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data.EntityPackets;
|
||||||
|
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||||
|
|
||||||
|
public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPackets1_19_3, ClientboundPackets1_19_4, ServerboundPackets1_19_3, ServerboundPackets1_19_4> {
|
||||||
|
|
||||||
|
private static final MappingData MAPPINGS = new MappingDataBase("1.19.3", "1.19.3");
|
||||||
|
private final EntityPackets entityRewriter = new EntityPackets(this);
|
||||||
|
|
||||||
|
public Protocol1_19_4To1_19_3() {
|
||||||
|
super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_4.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerPackets() {
|
||||||
|
// TODO fallback field in components
|
||||||
|
entityRewriter.register();
|
||||||
|
|
||||||
|
final CommandRewriter commandRewriter = new CommandRewriter(this) {
|
||||||
|
@Override
|
||||||
|
public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception {
|
||||||
|
if (argumentType.equals("minecraft:time")) {
|
||||||
|
// Minimum
|
||||||
|
wrapper.write(Type.INT, 0);
|
||||||
|
} else {
|
||||||
|
super.handleArgument(wrapper, argumentType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
commandRewriter.registerDeclareCommands1_19(ClientboundPackets1_19_3.DECLARE_COMMANDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final UserConnection user) {
|
||||||
|
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19_3Types.PLAYER));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MappingData getMappingData() {
|
||||||
|
return MAPPINGS;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2023 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
|
|
||||||
|
public enum ServerboundPackets1_19_4 implements ServerboundPacketType {
|
||||||
|
|
||||||
|
TELEPORT_CONFIRM, // 0x00
|
||||||
|
QUERY_BLOCK_NBT, // 0x01
|
||||||
|
SET_DIFFICULTY, // 0x02
|
||||||
|
CHAT_ACK, // 0x03
|
||||||
|
CHAT_COMMAND, // 0x04
|
||||||
|
CHAT_MESSAGE, // 0x05
|
||||||
|
CHAT_SESSION_UPDATE, // 0x06
|
||||||
|
CLIENT_STATUS, // 0x07
|
||||||
|
CLIENT_SETTINGS, // 0x08
|
||||||
|
TAB_COMPLETE, // 0x09
|
||||||
|
CLICK_WINDOW_BUTTON, // 0x0A
|
||||||
|
CLICK_WINDOW, // 0x0B
|
||||||
|
CLOSE_WINDOW, // 0x0C
|
||||||
|
PLUGIN_MESSAGE, // 0x0D
|
||||||
|
EDIT_BOOK, // 0x0E
|
||||||
|
ENTITY_NBT_REQUEST, // 0x0F
|
||||||
|
INTERACT_ENTITY, // 0x10
|
||||||
|
GENERATE_JIGSAW, // 0x11
|
||||||
|
KEEP_ALIVE, // 0x12
|
||||||
|
LOCK_DIFFICULTY, // 0x13
|
||||||
|
PLAYER_POSITION, // 0x14
|
||||||
|
PLAYER_POSITION_AND_ROTATION, // 0x15
|
||||||
|
PLAYER_ROTATION, // 0x16
|
||||||
|
PLAYER_MOVEMENT, // 0x17
|
||||||
|
VEHICLE_MOVE, // 0x18
|
||||||
|
STEER_BOAT, // 0x19
|
||||||
|
PICK_ITEM, // 0x1A
|
||||||
|
CRAFT_RECIPE_REQUEST, // 0x1B
|
||||||
|
PLAYER_ABILITIES, // 0x1C
|
||||||
|
PLAYER_DIGGING, // 0x1D
|
||||||
|
ENTITY_ACTION, // 0x1E
|
||||||
|
STEER_VEHICLE, // 0x1F
|
||||||
|
PONG, // 0x20
|
||||||
|
RECIPE_BOOK_DATA, // 0x21
|
||||||
|
SEEN_RECIPE, // 0x22
|
||||||
|
RENAME_ITEM, // 0x23
|
||||||
|
RESOURCE_PACK_STATUS, // 0x24
|
||||||
|
ADVANCEMENT_TAB, // 0x25
|
||||||
|
SELECT_TRADE, // 0x26
|
||||||
|
SET_BEACON_EFFECT, // 0x27
|
||||||
|
HELD_ITEM_CHANGE, // 0x28
|
||||||
|
UPDATE_COMMAND_BLOCK, // 0x29
|
||||||
|
UPDATE_COMMAND_BLOCK_MINECART, // 0x2A
|
||||||
|
CREATIVE_INVENTORY_ACTION, // 0x2B
|
||||||
|
UPDATE_JIGSAW_BLOCK, // 0x2C
|
||||||
|
UPDATE_STRUCTURE_BLOCK, // 0x2D
|
||||||
|
UPDATE_SIGN, // 0x2E
|
||||||
|
ANIMATION, // 0x2F
|
||||||
|
SPECTATE, // 0x30
|
||||||
|
PLAYER_BLOCK_PLACEMENT, // 0x31
|
||||||
|
USE_ITEM; // 0x32
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2023 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data;
|
||||||
|
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||||
|
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||||
|
|
||||||
|
public final class EntityPackets extends EntityRewriter<Protocol1_19_4To1_19_3> {
|
||||||
|
|
||||||
|
public EntityPackets(final Protocol1_19_4To1_19_3 protocol) {
|
||||||
|
super(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerPackets() {
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_3.JOIN_GAME, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.INT); // Entity id
|
||||||
|
map(Type.BOOLEAN); // Hardcore
|
||||||
|
map(Type.UNSIGNED_BYTE); // Gamemode
|
||||||
|
map(Type.BYTE); // Previous Gamemode
|
||||||
|
map(Type.STRING_ARRAY); // World List
|
||||||
|
map(Type.NBT); // Dimension registry
|
||||||
|
map(Type.STRING); // Dimension key
|
||||||
|
map(Type.STRING); // World
|
||||||
|
handler(dimensionDataHandler());
|
||||||
|
handler(biomeSizeTracker());
|
||||||
|
handler(worldDataTrackerHandlerByKey());
|
||||||
|
handler(wrapper -> {
|
||||||
|
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||||
|
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||||
|
final ListTag biomes = biomeRegistry.get("value");
|
||||||
|
for (final Tag biomeTag : biomes) {
|
||||||
|
final CompoundTag biomeData = ((CompoundTag) biomeTag).get("element");
|
||||||
|
final StringTag precipitation = biomeData.get("precipitation");
|
||||||
|
final byte precipitationByte = precipitation.getValue().equals("none") ? (byte) 0 : 1;
|
||||||
|
biomeData.put("has_precipitation", new ByteTag(precipitationByte));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_3.ENTITY_ANIMATION, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // Entity id
|
||||||
|
handler(wrapper -> {
|
||||||
|
final short action = wrapper.read(Type.UNSIGNED_BYTE);
|
||||||
|
if (action != 1) {
|
||||||
|
wrapper.write(Type.UNSIGNED_BYTE, action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.setPacketType(ClientboundPackets1_19_4.HIT_ANIMATION);
|
||||||
|
wrapper.write(Type.FLOAT, 0F);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_3.RESPAWN, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Dimension
|
||||||
|
map(Type.STRING); // World
|
||||||
|
handler(worldDataTrackerHandlerByKey());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityType typeFromId(final int type) {
|
||||||
|
return Entity1_19_3Types.getTypeFromId(type);
|
||||||
|
}
|
||||||
|
}
|
@ -80,6 +80,9 @@ public class CommandRewriter {
|
|||||||
this.parserHandlers.put("minecraft:resource_key", wrapper -> {
|
this.parserHandlers.put("minecraft:resource_key", wrapper -> {
|
||||||
wrapper.passthrough(Type.STRING); // Resource location/tag
|
wrapper.passthrough(Type.STRING); // Resource location/tag
|
||||||
});
|
});
|
||||||
|
this.parserHandlers.put("minecraft:time", wrapper -> {
|
||||||
|
wrapper.passthrough(Type.INT); // Minimum
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleArgument(PacketWrapper wrapper, String argumentType) throws Exception {
|
public void handleArgument(PacketWrapper wrapper, String argumentType) throws Exception {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||||
projectVersion=4.5.2-SNAPSHOT
|
projectVersion=4.6.0-23w03a-SNAPSHOT
|
||||||
|
|
||||||
# Gradle properties
|
# Gradle properties
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren