From 955b76f59902fee4039e73fdabb24f4f341ab1e8 Mon Sep 17 00:00:00 2001 From: F <60033407+FlorianMichael@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:30:03 +0200 Subject: [PATCH 1/2] Fix use-new-effect-indicator option for 1.13+ clients (#3127) --- .../packets/EntityPackets.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java index 6bb4ae6f0..b51c5bb7c 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java @@ -17,6 +17,7 @@ */ package com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets; +import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; @@ -146,6 +147,25 @@ public class EntityPackets { } }); + protocol.registerClientbound(ClientboundPackets1_12_1.ENTITY_EFFECT, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT); // Entity id + map(Type.BYTE); // Effect id + map(Type.BYTE); // Amplifier + map(Type.VAR_INT); // Duration + + handler(packetWrapper -> { + byte flags = packetWrapper.read(Type.BYTE); // Input Flags + + if (Via.getConfig().isNewEffectIndicator()) + flags |= 0x04; + + packetWrapper.write(Type.BYTE, flags); + }); + } + }); + metadataRewriter.registerRemoveEntities(ClientboundPackets1_12_1.DESTROY_ENTITIES); metadataRewriter.registerMetadataRewriter(ClientboundPackets1_12_1.ENTITY_METADATA, Types1_12.METADATA_LIST, Types1_13.METADATA_LIST); } From 17bd048d10d6df518fb4cb668834d8ea218b4936 Mon Sep 17 00:00:00 2001 From: Kevin Ludwig <32491319+valaphee@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:32:31 +0200 Subject: [PATCH 2/2] Fix missing zombie_pigman (1.15.2) => zombified_piglin (1.16) translation in mob_spawner entity (#3147) --- .../protocol1_16to1_15_2/packets/WorldPackets.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java index f8fd35a03..96e8f81cd 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java @@ -141,6 +141,17 @@ public class WorldPackets { compoundTag.put("Text" + i, new StringTag(text.toString())); } } + } else if (id.equals("minecraft:mob_spawner")) { + Tag spawnDataTag = compoundTag.get("SpawnData"); + if (spawnDataTag instanceof CompoundTag) { + Tag spawnDataIdTag = ((CompoundTag) spawnDataTag).get("id"); + if (spawnDataIdTag instanceof StringTag) { + StringTag spawnDataIdStringTag = ((StringTag) spawnDataIdTag); + if (spawnDataIdStringTag.getValue().equals("minecraft:zombie_pigman")) { + spawnDataIdStringTag.setValue("minecraft:zombified_piglin"); + } + } + } } } }