1.19-pre1

This commit is contained in:
Nassim Jahnke 2022-05-18 21:00:24 +02:00
parent f538f25d63
commit 854ecf0b47
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
5 changed files with 54 additions and 33 deletions

View File

@ -80,7 +80,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_17_1 = register(756, "1.17.1");
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
public static final ProtocolVersion v1_19 = register(759, 84, "1.19");
public static final ProtocolVersion v1_19 = register(759, 85, "1.19");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

View File

@ -96,35 +96,36 @@ public enum ClientboundPackets1_19 implements ClientboundPacketType {
UPDATE_VIEW_POSITION, // 0x48
UPDATE_VIEW_DISTANCE, // 0x49
SPAWN_POSITION, // 0x4A
DISPLAY_SCOREBOARD, // 0x4B
ENTITY_METADATA, // 0x4C
ATTACH_ENTITY, // 0x4D
ENTITY_VELOCITY, // 0x4E
ENTITY_EQUIPMENT, // 0x4F
SET_EXPERIENCE, // 0x50
UPDATE_HEALTH, // 0x51
SCOREBOARD_OBJECTIVE, // 0x52
SET_PASSENGERS, // 0x53
TEAMS, // 0x54
UPDATE_SCORE, // 0x55
SET_SIMULATION_DISTANCE, // 0x56
TITLE_SUBTITLE, // 0x57
TIME_UPDATE, // 0x58
TITLE_TEXT, // 0x59
TITLE_TIMES, // 0x5A
ENTITY_SOUND, // 0x5B
SOUND, // 0x5C
STOP_SOUND, // 0x5D
SYSTEM_CHAT, // 0x5E
TAB_LIST, // 0x5F
NBT_QUERY, // 0x60
COLLECT_ITEM, // 0x61
ENTITY_TELEPORT, // 0x62
ADVANCEMENTS, // 0x63
ENTITY_PROPERTIES, // 0x64
ENTITY_EFFECT, // 0x65
DECLARE_RECIPES, // 0x66
TAGS; // 0x67
SET_DISPLAY_CHAT_PREVIEW, // 0x4B
DISPLAY_SCOREBOARD, // 0x4C
ENTITY_METADATA, // 0x4D
ATTACH_ENTITY, // 0x4E
ENTITY_VELOCITY, // 0x4F
ENTITY_EQUIPMENT, // 0x50
SET_EXPERIENCE, // 0x51
UPDATE_HEALTH, // 0x52
SCOREBOARD_OBJECTIVE, // 0x53
SET_PASSENGERS, // 0x54
TEAMS, // 0x55
UPDATE_SCORE, // 0x56
SET_SIMULATION_DISTANCE, // 0x57
TITLE_SUBTITLE, // 0x58
TIME_UPDATE, // 0x59
TITLE_TEXT, // 0x5A
TITLE_TIMES, // 0x5B
ENTITY_SOUND, // 0x5C
SOUND, // 0x5D
STOP_SOUND, // 0x5E
SYSTEM_CHAT, // 0x5F
TAB_LIST, // 0x60
NBT_QUERY, // 0x61
COLLECT_ITEM, // 0x62
ENTITY_TELEPORT, // 0x63
ADVANCEMENTS, // 0x64
ENTITY_PROPERTIES, // 0x65
ENTITY_EFFECT, // 0x66
DECLARE_RECIPES, // 0x67
TAGS; // 0x68
@Override
public int getId() {

View File

@ -199,6 +199,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
}
});
read(Type.BOOLEAN); // Signed preview
}
});
cancelServerbound(ServerboundPackets1_19.CHAT_PREVIEW);

View File

@ -18,11 +18,11 @@
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.api.data.entity.DimensionData;
import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
@ -138,7 +138,10 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
map(Type.DOUBLE); // Z
map(Type.BYTE); // Pitch
map(Type.BYTE); // Yaw
create(Type.BYTE, (byte) 0); // Head yaw (moved over from mob spawn packet)
handler(wrapper -> {
final byte yaw = wrapper.get(Type.BYTE, 1);
wrapper.write(Type.BYTE, yaw); // Head yaw
});
map(Type.INT, Type.VAR_INT); // Data
handler(trackerHandler());
handler(wrapper -> {
@ -240,6 +243,8 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
for (final Tag dimension : dimensions) {
final CompoundTag dimensionCompound = (CompoundTag) dimension;
final CompoundTag element = dimensionCompound.get("element");
addMonsterSpawnData(element);
final String name = (String) dimensionCompound.get("name").getValue();
dimensionDataMap.put(name, new DimensionDataImpl(element));
dimensionsMap.put(element, name);
@ -258,6 +263,12 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
handler(playerTrackerHandler());
handler(worldDataTrackerHandlerByKey());
handler(biomeSizeTracker());
handler(wrapper -> {
// Disable the chat preview
final PacketWrapper displayPreviewPacket = wrapper.create(ClientboundPackets1_19.SET_DISPLAY_CHAT_PREVIEW);
displayPreviewPacket.write(Type.BOOLEAN, false);
displayPreviewPacket.send(Protocol1_19To1_18_2.class);
});
}
});
protocol.registerClientbound(ClientboundPackets1_18.RESPAWN, new PacketRemapper() {
@ -313,6 +324,8 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
private static void writeDimensionKey(PacketWrapper wrapper, DimensionRegistryStorage registryStorage) throws Exception {
// Find dimension key by data
final CompoundTag currentDimension = wrapper.read(Type.NBT);
addMonsterSpawnData(currentDimension);
final String dimensionKey = registryStorage.dimensionKey(currentDimension);
if (dimensionKey == null) {
throw new IllegalArgumentException("Unknown dimension sent on join: " + currentDimension);
@ -337,6 +350,12 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
throw new IllegalArgumentException("Unknown 2d id: " + id);
}
private static void addMonsterSpawnData(final CompoundTag dimension) {
// The actual values here don't matter
dimension.put("monster_spawn_block_light_limit", new IntTag(0));
dimension.put("monster_spawn_light_level", new IntTag(11));
}
@Override
protected void registerRewrites() {
filter().handler((event, meta) -> meta.setMetaType(Types1_19.META_TYPES.byId(meta.metaType().typeId())));

View File

@ -1,5 +1,5 @@
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
projectVersion=4.3.0-22w19a-SNAPSHOT
projectVersion=4.3.0-1.19-pre1-SNAPSHOT
# Gradle properties
org.gradle.daemon=true