3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 09:00:09 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-11-29 17:24:25 +01:00
Ursprung 8c0487fc05
Commit 96631cee0c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
8 geänderte Dateien mit 151 neuen und 89 gelöschten Zeilen

Datei anzeigen

@ -82,7 +82,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2"); public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
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, 110, "1.19.3"); public static final ProtocolVersion v1_19_3 = register(761, 111, "1.19.3");
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) {

Datei anzeigen

@ -96,6 +96,7 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
public static final IntType INT = new IntType(); public static final IntType INT = new IntType();
public static final FloatType FLOAT = new FloatType(); public static final FloatType FLOAT = new FloatType();
public static final FloatType.OptionalFloatType OPTIONAL_FLOAT = new FloatType.OptionalFloatType();
public static final DoubleType DOUBLE = new DoubleType(); public static final DoubleType DOUBLE = new DoubleType();
public static final LongType LONG = new LongType(); public static final LongType LONG = new LongType();

Datei anzeigen

@ -22,6 +22,7 @@
*/ */
package com.viaversion.viaversion.api.type.types; package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.TypeConverter; import com.viaversion.viaversion.api.type.TypeConverter;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -67,4 +68,11 @@ public class FloatType extends Type<Float> implements TypeConverter<Float> {
} }
return (Float) o; return (Float) o;
} }
public static final class OptionalFloatType extends OptionalType<Float> {
public OptionalFloatType() {
super(Type.FLOAT);
}
}
} }

Datei anzeigen

@ -43,92 +43,91 @@ public enum ClientboundPackets1_19_3 implements ClientboundPacketType {
COOLDOWN, // 0x13 COOLDOWN, // 0x13
CUSTOM_CHAT_COMPLETIONS, // 0x14 CUSTOM_CHAT_COMPLETIONS, // 0x14
PLUGIN_MESSAGE, // 0x15 PLUGIN_MESSAGE, // 0x15
NAMED_SOUND, // 0x16 DELETE_CHAT_MESSAGE, // 0x16
DELETE_CHAT_MESSAGE, // 0x17 DISCONNECT, // 0x17
DISCONNECT, // 0x18 DISGUISED_CHAT, // 0x18
DISGUISED_CHAT, // 0x19 ENTITY_STATUS, // 0x19
ENTITY_STATUS, // 0x1A EXPLOSION, // 0x1A
EXPLOSION, // 0x1B UNLOAD_CHUNK, // 0x1B
UNLOAD_CHUNK, // 0x1C GAME_EVENT, // 0x1C
GAME_EVENT, // 0x1D OPEN_HORSE_WINDOW, // 0x1D
OPEN_HORSE_WINDOW, // 0x1E WORLD_BORDER_INIT, // 0x1E
WORLD_BORDER_INIT, // 0x1F KEEP_ALIVE, // 0x1F
KEEP_ALIVE, // 0x20 CHUNK_DATA, // 0x20
CHUNK_DATA, // 0x21 EFFECT, // 0x21
EFFECT, // 0x22 SPAWN_PARTICLE, // 0x22
SPAWN_PARTICLE, // 0x23 UPDATE_LIGHT, // 0x23
UPDATE_LIGHT, // 0x24 JOIN_GAME, // 0x24
JOIN_GAME, // 0x25 MAP_DATA, // 0x25
MAP_DATA, // 0x26 TRADE_LIST, // 0x26
TRADE_LIST, // 0x27 ENTITY_POSITION, // 0x27
ENTITY_POSITION, // 0x28 ENTITY_POSITION_AND_ROTATION, // 0x28
ENTITY_POSITION_AND_ROTATION, // 0x29 ENTITY_ROTATION, // 0x29
ENTITY_ROTATION, // 0x2A VEHICLE_MOVE, // 0x2A
VEHICLE_MOVE, // 0x2B OPEN_BOOK, // 0x2B
OPEN_BOOK, // 0x2C OPEN_WINDOW, // 0x2C
OPEN_WINDOW, // 0x2D OPEN_SIGN_EDITOR, // 0x2D
OPEN_SIGN_EDITOR, // 0x2E PING, // 0x2E
PING, // 0x2F CRAFT_RECIPE_RESPONSE, // 0x2F
CRAFT_RECIPE_RESPONSE, // 0x30 PLAYER_ABILITIES, // 0x30
PLAYER_ABILITIES, // 0x31 PLAYER_CHAT, // 0x31
PLAYER_CHAT, // 0x32 COMBAT_END, // 0x32
COMBAT_END, // 0x33 COMBAT_ENTER, // 0x33
COMBAT_ENTER, // 0x34 COMBAT_KILL, // 0x34
COMBAT_KILL, // 0x35 PLAYER_INFO_REMOVE, // 0x35
PLAYER_INFO_REMOVE, // 0x36 PLAYER_INFO_UPDATE, // 0x36
PLAYER_INFO_UPDATE, // 0x37 FACE_PLAYER, // 0x37
FACE_PLAYER, // 0x38 PLAYER_POSITION, // 0x38
PLAYER_POSITION, // 0x39 UNLOCK_RECIPES, // 0x39
UNLOCK_RECIPES, // 0x3A REMOVE_ENTITIES, // 0x3A
REMOVE_ENTITIES, // 0x3B REMOVE_ENTITY_EFFECT, // 0x3B
REMOVE_ENTITY_EFFECT, // 0x3C RESOURCE_PACK, // 0x3C
RESOURCE_PACK, // 0x3D RESPAWN, // 0x3D
RESPAWN, // 0x3E ENTITY_HEAD_LOOK, // 0x3E
ENTITY_HEAD_LOOK, // 0x3F MULTI_BLOCK_CHANGE, // 0x3F
MULTI_BLOCK_CHANGE, // 0x40 SELECT_ADVANCEMENTS_TAB, // 0x40
SELECT_ADVANCEMENTS_TAB, // 0x41 SERVER_DATA, // 0x41
SERVER_DATA, // 0x42 ACTIONBAR, // 0x42
ACTIONBAR, // 0x43 WORLD_BORDER_CENTER, // 0x43
WORLD_BORDER_CENTER, // 0x44 WORLD_BORDER_LERP_SIZE, // 0x44
WORLD_BORDER_LERP_SIZE, // 0x45 WORLD_BORDER_SIZE, // 0x45
WORLD_BORDER_SIZE, // 0x46 WORLD_BORDER_WARNING_DELAY, // 0x46
WORLD_BORDER_WARNING_DELAY, // 0x47 WORLD_BORDER_WARNING_DISTANCE, // 0x47
WORLD_BORDER_WARNING_DISTANCE, // 0x48 CAMERA, // 0x48
CAMERA, // 0x49 HELD_ITEM_CHANGE, // 0x49
HELD_ITEM_CHANGE, // 0x4A UPDATE_VIEW_POSITION, // 0x4A
UPDATE_VIEW_POSITION, // 0x4B UPDATE_VIEW_DISTANCE, // 0x4B
UPDATE_VIEW_DISTANCE, // 0x4C SPAWN_POSITION, // 0x4C
SPAWN_POSITION, // 0x4D DISPLAY_SCOREBOARD, // 0x4D
DISPLAY_SCOREBOARD, // 0x4E ENTITY_METADATA, // 0x4E
ENTITY_METADATA, // 0x4F ATTACH_ENTITY, // 0x4F
ATTACH_ENTITY, // 0x50 ENTITY_VELOCITY, // 0x50
ENTITY_VELOCITY, // 0x51 ENTITY_EQUIPMENT, // 0x51
ENTITY_EQUIPMENT, // 0x52 SET_EXPERIENCE, // 0x52
SET_EXPERIENCE, // 0x53 UPDATE_HEALTH, // 0x53
UPDATE_HEALTH, // 0x54 SCOREBOARD_OBJECTIVE, // 0x54
SCOREBOARD_OBJECTIVE, // 0x55 SET_PASSENGERS, // 0x55
SET_PASSENGERS, // 0x56 TEAMS, // 0x56
TEAMS, // 0x57 UPDATE_SCORE, // 0x57
UPDATE_SCORE, // 0x58 SET_SIMULATION_DISTANCE, // 0x58
SET_SIMULATION_DISTANCE, // 0x59 TITLE_SUBTITLE, // 0x59
TITLE_SUBTITLE, // 0x5A TIME_UPDATE, // 0x5A
TIME_UPDATE, // 0x5B TITLE_TEXT, // 0x5B
TITLE_TEXT, // 0x5C TITLE_TIMES, // 0x5C
TITLE_TIMES, // 0x5D ENTITY_SOUND, // 0x5D
ENTITY_SOUND, // 0x5E SOUND, // 0x5E
SOUND, // 0x5F STOP_SOUND, // 0x5F
STOP_SOUND, // 0x60 SYSTEM_CHAT, // 0x60
SYSTEM_CHAT, // 0x61 TAB_LIST, // 0x61
TAB_LIST, // 0x62 NBT_QUERY, // 0x62
NBT_QUERY, // 0x63 COLLECT_ITEM, // 0x63
COLLECT_ITEM, // 0x64 ENTITY_TELEPORT, // 0x64
ENTITY_TELEPORT, // 0x65 ADVANCEMENTS, // 0x65
ADVANCEMENTS, // 0x66 ENTITY_PROPERTIES, // 0x66
ENTITY_PROPERTIES, // 0x67 UPDATE_ENABLED_FEATURES, // 0x67
UPDATE_ENABLED_FEATURES, // 0x68 ENTITY_EFFECT, // 0x68
ENTITY_EFFECT, // 0x69 DECLARE_RECIPES, // 0x69
DECLARE_RECIPES, // 0x6A TAGS; // 0x6A
TAGS; // 0x6B
@Override @Override
public int getId() { public int getId() {

Datei anzeigen

@ -76,8 +76,29 @@ public final class Protocol1_19_3To1_19_1 extends AbstractProtocol<ClientboundPa
itemRewriter.register(); itemRewriter.register();
final SoundRewriter soundRewriter = new SoundRewriter(this); final SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_19_1.SOUND);
soundRewriter.registerSound(ClientboundPackets1_19_1.ENTITY_SOUND); soundRewriter.registerSound(ClientboundPackets1_19_1.ENTITY_SOUND);
registerClientbound(ClientboundPackets1_19_1.SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Sound id
handler(soundRewriter.getSoundHandler());
handler(wrapper -> {
// 0 means a resource location will be written
final int soundId = wrapper.get(Type.VAR_INT, 0);
wrapper.set(Type.VAR_INT, 0, soundId + 1);
});
}
});
registerClientbound(ClientboundPackets1_19_1.NAMED_SOUND, ClientboundPackets1_19_3.SOUND, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.write(Type.VAR_INT, 0);
wrapper.passthrough(Type.STRING); // Sound identifier
wrapper.write(Type.OPTIONAL_FLOAT, null); // No fixed range
});
}
});
new StatisticsRewriter(this).register(ClientboundPackets1_19_1.STATISTICS); new StatisticsRewriter(this).register(ClientboundPackets1_19_1.STATISTICS);

Datei anzeigen

@ -48,6 +48,33 @@ public class SoundRewriter {
}); });
} }
// Different to entity sounds now
public void register1_19_3Sound(ClientboundPacketType packetType) {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
int soundId = wrapper.read(Type.VAR_INT);
if (soundId == 0) {
// Is followed by the resource loation
wrapper.write(Type.VAR_INT, 0);
return;
}
// The id needs to be normalized
soundId--;
final int mappedId = idRewriter.rewrite(soundId);
if (mappedId == -1) {
wrapper.cancel();
return;
}
wrapper.write(Type.VAR_INT, mappedId + 1);
});
}
});
}
public PacketHandler getSoundHandler() { public PacketHandler getSoundHandler() {
return wrapper -> { return wrapper -> {
int soundId = wrapper.get(Type.VAR_INT, 0); int soundId = wrapper.get(Type.VAR_INT, 0);

Datei anzeigen

@ -26245,6 +26245,12 @@
"block.note_block.didgeridoo", "block.note_block.didgeridoo",
"block.note_block.bit", "block.note_block.bit",
"block.note_block.banjo", "block.note_block.banjo",
"block.note_block.imitate.zombie",
"block.note_block.imitate.skeleton",
"block.note_block.imitate.creeper",
"block.note_block.imitate.ender_dragon",
"block.note_block.imitate.wither_skeleton",
"block.note_block.imitate.piglin",
"entity.ocelot.hurt", "entity.ocelot.hurt",
"entity.ocelot.ambient", "entity.ocelot.ambient",
"entity.ocelot.death", "entity.ocelot.death",

Datei anzeigen

@ -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.0-1.19.3-pre2-SNAPSHOT projectVersion=4.5.0-1.19.3-pre3-SNAPSHOT
# Gradle properties # Gradle properties
org.gradle.daemon=true org.gradle.daemon=true