diff --git a/api-legacy/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/api-legacy/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java index 52667c0b6..ddcb193d4 100644 --- a/api-legacy/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java +++ b/api-legacy/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java @@ -85,6 +85,8 @@ public class ProtocolVersion { public static final ProtocolVersion v1_19 = register(759, "1.19"); public static final ProtocolVersion v1_19_1 = register(760, "1.19.1"); public static final ProtocolVersion v1_19_3 = register(761, "1.19.3"); + public static final ProtocolVersion v1_19_4 = register(762, "1.19.4"); + public static final ProtocolVersion v1_20 = register(763, "1.20"); public static final ProtocolVersion unknown = register(-1, "UNKNOWN"); public static ProtocolVersion register(int version, String name) { diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java index 2d252342f..6e5bffbc0 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java @@ -83,7 +83,7 @@ public class ProtocolVersion { 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_4 = register(762, "1.19.4"); - public static final ProtocolVersion v1_20 = register(763, 133, "1.20"); + public static final ProtocolVersion v1_20 = register(763, 134, "1.20"); public static final ProtocolVersion unknown = register(-1, "UNKNOWN"); public static ProtocolVersion register(int version, String name) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/data/MappingData.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/data/MappingData.java index 06ceb53d6..089cf4351 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/data/MappingData.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/data/MappingData.java @@ -34,8 +34,7 @@ public final class MappingData extends MappingDataBase { @Override protected void loadExtras(final CompoundTag data) { try { - // TODO Read uncompressed file - damageTypesRegistry = BinaryTagIO.readCompressedInputStream(MappingDataLoader.getResource("damage-types-1.19.4.nbt")); + damageTypesRegistry = BinaryTagIO.readInputStream(MappingDataLoader.getResource("damage-types-1.19.4.nbt")); } catch (final IOException e) { throw new RuntimeException(e); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/EntityPackets.java index 7a327d6a0..57274dcda 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20to1_19_4/packets/EntityPackets.java @@ -17,6 +17,13 @@ */ package com.viaversion.viaversion.protocols.protocol1_20to1_19_4.packets; +import com.github.steveice10.opennbt.tag.builtin.ByteTag; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.FloatTag; +import com.github.steveice10.opennbt.tag.builtin.IntTag; +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_4Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; @@ -50,9 +57,51 @@ public final class EntityPackets extends EntityRewriter { + final CompoundTag registry = wrapper.get(Type.NBT, 0); + final CompoundTag damageTypeRegistry = registry.get("minecraft:damage_type"); + final ListTag damageTypes = damageTypeRegistry.get("value"); + int highestId = -1; + for (final Tag damageType : damageTypes) { + final IntTag id = ((CompoundTag) damageType).get("id"); + highestId = Math.max(highestId, id.asInt()); + } + + // AaaaAAAaa + final CompoundTag outsideBorderReason = new CompoundTag(); + final CompoundTag outsideBorderElement = new CompoundTag(); + outsideBorderElement.put("scaling", new StringTag("always")); + outsideBorderElement.put("exhaustion", new FloatTag(0F)); + outsideBorderElement.put("message_id", new StringTag("badRespawnPoint")); + outsideBorderReason.put("id", new IntTag(highestId + 1)); + outsideBorderReason.put("name", new StringTag("minecraft:outside_border")); + outsideBorderReason.put("element", outsideBorderElement); + damageTypes.add(outsideBorderReason); + + final CompoundTag genericKillReason = new CompoundTag(); + final CompoundTag genericKillElement = new CompoundTag(); + genericKillElement.put("scaling", new StringTag("always")); + genericKillElement.put("exhaustion", new FloatTag(0F)); + genericKillElement.put("message_id", new StringTag("badRespawnPoint")); + genericKillReason.put("id", new IntTag(highestId + 2)); + genericKillReason.put("name", new StringTag("minecraft:generic_kill")); + genericKillReason.put("element", genericKillElement); + damageTypes.add(genericKillReason); + }); } }); @@ -61,6 +110,14 @@ public final class EntityPackets extends EntityRewriter