3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Move config option check for placement fix into packet handlers (#4248)

Fixes the config option breaking when using the reload command, also changes the message when using the /reload sub command.
Dieser Commit ist enthalten in:
EnZaXD 2024-11-06 15:46:11 +01:00 committet von GitHub
Ursprung 1620fc35f5
Commit 8e4da81022
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
2 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -35,7 +35,7 @@ public class ReloadSubCmd implements ViaSubCommand {
@Override @Override
public boolean execute(ViaCommandSender sender, String[] args) { public boolean execute(ViaCommandSender sender, String[] args) {
Via.getManager().getConfigurationProvider().reloadConfigs(); Via.getManager().getConfigurationProvider().reloadConfigs();
sendMessage(sender, "&6Configuration successfully reloaded! Some features may need a restart."); sendMessage(sender, "&6Configuration successfully reloaded! Some config options may require a restart to take effect.");
return true; return true;
} }
} }

Datei anzeigen

@ -125,10 +125,10 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
}); });
// Tracks on ground state for block interactions // Tracks on ground state for block interactions
protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_POS, wrapper -> {
if (!Via.getConfig().fix1_21PlacementRotation()) { if (!Via.getConfig().fix1_21PlacementRotation()) {
return; return;
} }
protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_POS, wrapper -> {
wrapper.passthrough(Types.DOUBLE); // X wrapper.passthrough(Types.DOUBLE); // X
wrapper.passthrough(Types.DOUBLE); // Y wrapper.passthrough(Types.DOUBLE); // Y
wrapper.passthrough(Types.DOUBLE); // Z wrapper.passthrough(Types.DOUBLE); // Z
@ -136,12 +136,18 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN)); wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN));
}); });
protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_ROT, wrapper -> { protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_ROT, wrapper -> {
if (!Via.getConfig().fix1_21PlacementRotation()) {
return;
}
wrapper.passthrough(Types.FLOAT); // Yaw wrapper.passthrough(Types.FLOAT); // Yaw
wrapper.passthrough(Types.FLOAT); // Pitch wrapper.passthrough(Types.FLOAT); // Pitch
wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN)); wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN));
}); });
protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_POS_ROT, wrapper -> { protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_POS_ROT, wrapper -> {
if (!Via.getConfig().fix1_21PlacementRotation()) {
return;
}
wrapper.passthrough(Types.DOUBLE); // X wrapper.passthrough(Types.DOUBLE); // X
wrapper.passthrough(Types.DOUBLE); // Y wrapper.passthrough(Types.DOUBLE); // Y
wrapper.passthrough(Types.DOUBLE); // Z wrapper.passthrough(Types.DOUBLE); // Z
@ -151,6 +157,9 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN)); wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN));
}); });
protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_STATUS_ONLY, wrapper -> { protocol.registerServerbound(ServerboundPackets1_20_5.MOVE_PLAYER_STATUS_ONLY, wrapper -> {
if (!Via.getConfig().fix1_21PlacementRotation()) {
return;
}
wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN)); wrapper.user().get(OnGroundTracker.class).setOnGround(wrapper.passthrough(Types.BOOLEAN));
}); });
} }