From 298b07a3be40178aec020f1fa5490adcace0e4c8 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 3 Nov 2024 17:50:12 +0100 Subject: [PATCH 1/6] Change darkness->blindness in 1.19->1.18.2 --- .../v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java index 35ea0a14..ecbd0bb3 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java @@ -111,6 +111,11 @@ public void register() { handler(wrapper -> { // Remove factor data wrapper.read(Types.OPTIONAL_NAMED_COMPOUND_TAG); + + final int effectId = wrapper.get(Types.VAR_INT, 1); + if (effectId == 33) { // Newly added darkness, rewrite to blindness + wrapper.set(Types.VAR_INT, 1, 15); + } }); } }); From 80633cdf6980ffba014f284487d6fc8371e64080 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 3 Nov 2024 17:50:45 +0100 Subject: [PATCH 2/6] Bump version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6a28f64f..f88f29d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=5.1.1 +projectVersion=5.1.2-SNAPSHOT # Smile emoji mcVersions=1.21.3,1.21.2,1.21.1,1.21,1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 From a3c5a9a7de1d60754413f212360cc507d68fae0a Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 3 Nov 2024 19:52:11 +0100 Subject: [PATCH 3/6] Handle removal, add config option --- .../viabackwards/ViaBackwardsConfig.java | 7 +++ .../viabackwards/api/ViaBackwardsConfig.java | 7 +++ .../v1_19to1_18_2/Protocol1_19To1_18_2.java | 5 +- .../rewriter/EntityPacketRewriter1_19.java | 38 +++++++++++++ .../storage/EntityTracker1_19.java | 57 +++++++++++++++++++ .../resources/assets/viabackwards/config.yml | 5 +- 6 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java diff --git a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java index 9ee39754..379b8c5f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java @@ -36,6 +36,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback private boolean handlePingsAsInvAcknowledgements; private boolean bedrockAtY0; private boolean sculkShriekersToCryingObsidian; + private boolean mapDarknessEffect; private boolean suppressEmulationWarnings; public ViaBackwardsConfig(File configFile, Logger logger) { @@ -57,6 +58,7 @@ private void loadFields() { handlePingsAsInvAcknowledgements = getBoolean("handle-pings-as-inv-acknowledgements", false); bedrockAtY0 = getBoolean("bedrock-at-y-0", false); sculkShriekersToCryingObsidian = getBoolean("sculk-shriekers-to-crying-obsidian", false); + mapDarknessEffect = getBoolean("map-darkness-effect", false); suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false); } @@ -100,6 +102,11 @@ public boolean sculkShriekerToCryingObsidian() { return sculkShriekersToCryingObsidian; } + @Override + public boolean mapDarknessEffect() { + return mapDarknessEffect; + } + @Override public boolean suppressEmulationWarnings() { return suppressEmulationWarnings; diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java index 08f0902a..f9cd38a8 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java @@ -78,6 +78,13 @@ public interface ViaBackwardsConfig extends Config { */ boolean sculkShriekerToCryingObsidian(); + /** + * Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers. + * + * @return true if enabled + */ + boolean mapDarknessEffect(); + /** * Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+). * diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java index 4635fcea..481fdd1d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java @@ -28,11 +28,11 @@ import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.CommandRewriter1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.EntityPacketRewriter1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.DimensionRegistryStorage; +import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.EntityTracker1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.NonceStorage; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.RegistryType; -import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19; import com.viaversion.viaversion.api.minecraft.signature.SignableCommandArgumentsProvider; import com.viaversion.viaversion.api.minecraft.signature.model.DecoratableMessage; import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata; @@ -40,7 +40,6 @@ import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; -import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets; import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets; @@ -364,7 +363,7 @@ public void register() { @Override public void init(final UserConnection user) { user.put(new DimensionRegistryStorage()); - addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_19.PLAYER)); + addEntityTracker(user, new EntityTracker1_19(user)); } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java index ecbd0bb3..6634e787 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java @@ -20,9 +20,11 @@ import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.NumberTag; +import com.viaversion.viabackwards.ViaBackwards; import com.viaversion.viabackwards.api.rewriters.EntityRewriter; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.Protocol1_19To1_18_2; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.DimensionRegistryStorage; +import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.EntityTracker1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.LastDeathPosition; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.StoredPainting; import com.viaversion.viaversion.api.data.ParticleMappings; @@ -112,14 +114,50 @@ public void register() { // Remove factor data wrapper.read(Types.OPTIONAL_NAMED_COMPOUND_TAG); + if (!ViaBackwards.getConfig().mapDarknessEffect()) { + return; + } + final EntityTracker1_19 tracker = tracker(wrapper.user()); + + final int entityId = wrapper.get(Types.VAR_INT, 0); final int effectId = wrapper.get(Types.VAR_INT, 1); if (effectId == 33) { // Newly added darkness, rewrite to blindness wrapper.set(Types.VAR_INT, 1, 15); + tracker.addDarkness(entityId); + } else if (effectId == 15) { // Track actual blindness effect for removal later + tracker.addBlindness(entityId); } }); } }); + if (ViaBackwards.getConfig().mapDarknessEffect()) { + protocol.registerClientbound(ClientboundPackets1_19.REMOVE_MOB_EFFECT, new PacketHandlers() { + @Override + protected void register() { + map(Types.VAR_INT); // Entity id + map(Types.VAR_INT); // Effect id + handler(wrapper -> { + final int entityId = wrapper.get(Types.VAR_INT, 0); + final int effectId = wrapper.get(Types.VAR_INT, 1); + + final EntityTracker1_19 tracker = tracker(wrapper.user()); + if (effectId == 33) { + // Don't rewrite darkness to blindness if the entity has blindness too, as it would be removed otherwise + if (!tracker.isAffectedByBlindness(entityId)) { + wrapper.set(Types.VAR_INT, 1, 15); + } + } else if (effectId == 15) { + // Don't remove blindness when we are using it to emulate darkness + if (tracker.isAffectedByDarkness(entityId)) { + wrapper.cancel(); + } + } + }); + } + }); + } + protocol.registerClientbound(ClientboundPackets1_19.LOGIN, new PacketHandlers() { @Override public void register() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java new file mode 100644 index 00000000..229d1a30 --- /dev/null +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java @@ -0,0 +1,57 @@ +/* + * This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards + * Copyright (C) 2016-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage; + +import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19; +import com.viaversion.viaversion.data.entity.EntityTrackerBase; +import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList; +import com.viaversion.viaversion.libs.fastutil.ints.IntList; + +public final class EntityTracker1_19 extends EntityTrackerBase { + + private final IntList affectedByDarkness = new IntArrayList(); + private final IntList affectedByBlindness = new IntArrayList(); + + public EntityTracker1_19(final UserConnection connection) { + super(connection, EntityTypes1_19.PLAYER); + } + + @Override + public void removeEntity(final int id) { + super.removeEntity(id); + this.affectedByBlindness.rem(id); + this.affectedByDarkness.rem(id); + } + + public void addDarkness(final int id) { + this.affectedByDarkness.add(id); + } + + public void addBlindness(final int id) { + this.affectedByBlindness.add(id); + } + + public boolean isAffectedByDarkness(final int id) { + return this.affectedByDarkness.contains(id); + } + + public boolean isAffectedByBlindness(final int id) { + return this.affectedByBlindness.contains(id); + } +} diff --git a/common/src/main/resources/assets/viabackwards/config.yml b/common/src/main/resources/assets/viabackwards/config.yml index f2ff5f37..92c15d1f 100644 --- a/common/src/main/resources/assets/viabackwards/config.yml +++ b/common/src/main/resources/assets/viabackwards/config.yml @@ -28,5 +28,8 @@ bedrock-at-y-0: false # If disabled, the client will see them as end portal frames. sculk-shriekers-to-crying-obsidian: true # +# Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers. +map-darkness-effect: true +# # Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+). -suppress-emulation-warnings: false \ No newline at end of file +suppress-emulation-warnings: false From 0125b0e59f936f53ac4ecc5066b69f2ba6a517a4 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 3 Nov 2024 20:17:03 +0100 Subject: [PATCH 4/6] Track states correctly --- .../rewriter/EntityPacketRewriter1_19.java | 16 ++++++++-------- .../storage/EntityTracker1_19.java | 18 +++++------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java index 6634e787..23b70082 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java @@ -122,10 +122,10 @@ public void register() { final int entityId = wrapper.get(Types.VAR_INT, 0); final int effectId = wrapper.get(Types.VAR_INT, 1); if (effectId == 33) { // Newly added darkness, rewrite to blindness + tracker.getAffectedByDarkness().add(entityId); wrapper.set(Types.VAR_INT, 1, 15); - tracker.addDarkness(entityId); } else if (effectId == 15) { // Track actual blindness effect for removal later - tracker.addBlindness(entityId); + tracker.getAffectedByBlindness().add(entityId); } }); } @@ -142,14 +142,14 @@ protected void register() { final int effectId = wrapper.get(Types.VAR_INT, 1); final EntityTracker1_19 tracker = tracker(wrapper.user()); - if (effectId == 33) { - // Don't rewrite darkness to blindness if the entity has blindness too, as it would be removed otherwise - if (!tracker.isAffectedByBlindness(entityId)) { + if (effectId == 33) { // Remove darkness and the fake blindness effect if the client doesn't have actual blindness + tracker.getAffectedByDarkness().rem(entityId); + if (!tracker.getAffectedByBlindness().contains(entityId)) { wrapper.set(Types.VAR_INT, 1, 15); } - } else if (effectId == 15) { - // Don't remove blindness when we are using it to emulate darkness - if (tracker.isAffectedByDarkness(entityId)) { + } else if (effectId == 15) { // Remove blindness and cancel if the client has darkness (will be removed by darkness removal) + tracker.getAffectedByBlindness().rem(entityId); + if (tracker.getAffectedByDarkness().contains(entityId)) { wrapper.cancel(); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java index 229d1a30..37c6d1c8 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java @@ -25,8 +25,8 @@ public final class EntityTracker1_19 extends EntityTrackerBase { - private final IntList affectedByDarkness = new IntArrayList(); private final IntList affectedByBlindness = new IntArrayList(); + private final IntList affectedByDarkness = new IntArrayList(); public EntityTracker1_19(final UserConnection connection) { super(connection, EntityTypes1_19.PLAYER); @@ -39,19 +39,11 @@ public void removeEntity(final int id) { this.affectedByDarkness.rem(id); } - public void addDarkness(final int id) { - this.affectedByDarkness.add(id); - } - - public void addBlindness(final int id) { - this.affectedByBlindness.add(id); - } - - public boolean isAffectedByDarkness(final int id) { - return this.affectedByDarkness.contains(id); + public IntList getAffectedByBlindness() { + return affectedByBlindness; } - public boolean isAffectedByBlindness(final int id) { - return this.affectedByBlindness.contains(id); + public IntList getAffectedByDarkness() { + return affectedByDarkness; } } From 7496901e69bc770ec6c3571aff4c0cff3108e387 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Wed, 6 Nov 2024 17:11:17 +0100 Subject: [PATCH 5/6] Move config option check into handler --- .../rewriter/EntityPacketRewriter1_19.java | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java index 23b70082..1b0a4659 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java @@ -131,32 +131,33 @@ public void register() { } }); - if (ViaBackwards.getConfig().mapDarknessEffect()) { - protocol.registerClientbound(ClientboundPackets1_19.REMOVE_MOB_EFFECT, new PacketHandlers() { - @Override - protected void register() { - map(Types.VAR_INT); // Entity id - map(Types.VAR_INT); // Effect id - handler(wrapper -> { - final int entityId = wrapper.get(Types.VAR_INT, 0); - final int effectId = wrapper.get(Types.VAR_INT, 1); - - final EntityTracker1_19 tracker = tracker(wrapper.user()); - if (effectId == 33) { // Remove darkness and the fake blindness effect if the client doesn't have actual blindness - tracker.getAffectedByDarkness().rem(entityId); - if (!tracker.getAffectedByBlindness().contains(entityId)) { - wrapper.set(Types.VAR_INT, 1, 15); - } - } else if (effectId == 15) { // Remove blindness and cancel if the client has darkness (will be removed by darkness removal) - tracker.getAffectedByBlindness().rem(entityId); - if (tracker.getAffectedByDarkness().contains(entityId)) { - wrapper.cancel(); - } + protocol.registerClientbound(ClientboundPackets1_19.REMOVE_MOB_EFFECT, new PacketHandlers() { + @Override + protected void register() { + map(Types.VAR_INT); // Entity id + map(Types.VAR_INT); // Effect id + handler(wrapper -> { + if (!ViaBackwards.getConfig().mapDarknessEffect()) { + return; + } + final int entityId = wrapper.get(Types.VAR_INT, 0); + final int effectId = wrapper.get(Types.VAR_INT, 1); + + final EntityTracker1_19 tracker = tracker(wrapper.user()); + if (effectId == 33) { // Remove darkness and the fake blindness effect if the client doesn't have actual blindness + tracker.getAffectedByDarkness().rem(entityId); + if (!tracker.getAffectedByBlindness().contains(entityId)) { + wrapper.set(Types.VAR_INT, 1, 15); } - }); - } - }); - } + } else if (effectId == 15) { // Remove blindness and cancel if the client has darkness (will be removed by darkness removal) + tracker.getAffectedByBlindness().rem(entityId); + if (tracker.getAffectedByDarkness().contains(entityId)) { + wrapper.cancel(); + } + } + }); + } + }); protocol.registerClientbound(ClientboundPackets1_19.LOGIN, new PacketHandlers() { @Override From 59f3c93c0a2e8a98b8992c4074fe8ca791a49f51 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 7 Nov 2024 09:17:55 +0100 Subject: [PATCH 6/6] Config default, new lines --- .../java/com/viaversion/viabackwards/ViaBackwardsConfig.java | 2 +- .../v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java index 379b8c5f..81d626cc 100644 --- a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java @@ -58,7 +58,7 @@ private void loadFields() { handlePingsAsInvAcknowledgements = getBoolean("handle-pings-as-inv-acknowledgements", false); bedrockAtY0 = getBoolean("bedrock-at-y-0", false); sculkShriekersToCryingObsidian = getBoolean("sculk-shriekers-to-crying-obsidian", false); - mapDarknessEffect = getBoolean("map-darkness-effect", false); + mapDarknessEffect = getBoolean("map-darkness-effect", true); suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java index 1b0a4659..2c9e8cbf 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/rewriter/EntityPacketRewriter1_19.java @@ -117,6 +117,7 @@ public void register() { if (!ViaBackwards.getConfig().mapDarknessEffect()) { return; } + final EntityTracker1_19 tracker = tracker(wrapper.user()); final int entityId = wrapper.get(Types.VAR_INT, 0); @@ -140,6 +141,7 @@ protected void register() { if (!ViaBackwards.getConfig().mapDarknessEffect()) { return; } + final int entityId = wrapper.get(Types.VAR_INT, 0); final int effectId = wrapper.get(Types.VAR_INT, 1);