From 07bdb57694aa501ef848e5e2ed422a39615bf169 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 10 May 2023 15:01:33 +0200 Subject: [PATCH] 1.20-pre1 --- .../api/protocol/ProtocolVersion.java | 2 + .../api/protocol/version/ProtocolVersion.java | 2 +- .../data/MappingData.java | 3 +- .../packets/EntityPackets.java | 57 ++++++++++++++++++ .../viaversion/data/damage-types-1.19.4.nbt | Bin 973 -> 5838 bytes gradle.properties | 2 +- 6 files changed, 62 insertions(+), 4 deletions(-) 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 EntityRewriterqGWk@7N=R7bYBjAfX?)yLuPvDw9_1N#DFA7p@skr2uV?&F@2~0 zAO-$_$+WIS`Dl}a@6*2#z&MIV(V5SvicyJH^yf%VXht+E=X3>YDK3pO`J~e% zrea0c<$v(bVbwqCMSr(zj-soKQ8OjZsS4LMJb~W{##E33qCzrO@q&7f+flNbaNEYDeL%4k%*13}xml-m&+RBNKqr5~O(QH!R4sEi?7}kaRJdCY9W|>V>kL^r6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@hv&dAEzjH8Ql@Cssiqz8ULHiH zy3|&_=r^=v?`ATCl~iYK&)*G_q^*|YFCae0a7;;DbuzRUWWQ|#>ph^pE@Y&01g478 zA8pO-`&({3X|*l4-+;Y6H=}|o7F(%6}uaxP)C6Jn0_@N?>(UjvQ)75!n{D5Sx)2j1&s?2k^7f;h#a)hUN4h7 z+qIB_#n888Zkeb5&Ge+(h4a(Ql{U*eSLg>}mfeB8S27q@v)18ZnDexOcw035#C?)@ z6y|kRGrZMSRFrBQQ3Vh0s4Ut~5|6#Tp+A*pt365gYJsugj{)ypAw7{wv~P$fezRuM zD)(p;@efAbFDFmK^oR!HZRA?9gu3s1&w>aH&MD5|)ESfl`lMn}sUi6C^Yi)IF3QUX vOJ|KLrYE$0QM?GVuN#Q>U~7hOaaOv-ybQ8X+YRcAApzt!Aw}>4&K3Xw3QFCX diff --git a/gradle.properties b/gradle.properties index 5b33f7536..bf2a39d98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.7.0-23w18a-SNAPSHOT +projectVersion=4.7.0-1.20-pre1-SNAPSHOT # Gradle properties org.gradle.daemon=true