3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 23:30:17 +01:00

Don't expect enables features to always be sent

The client defaults to the vanilla registry, so it doesn't need to be sent
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-11-05 11:50:33 +10:00
Ursprung 71f08b9e4e
Commit bce716caa4
2 geänderte Dateien mit 8 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -21,8 +21,8 @@ import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.Protocol1_20To1_20_2; import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.Protocol1_20To1_20_2;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.storage.ConfigurationPacketStorage; import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.storage.ConfigurationPacketStorage;
import com.viaversion.viaversion.api.minecraft.GlobalPosition; import com.viaversion.viaversion.api.minecraft.GlobalPosition;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
@ -143,9 +143,11 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter<Clientbound
wrapper.send(Protocol1_20To1_20_2.class); wrapper.send(Protocol1_20To1_20_2.class);
wrapper.cancel(); wrapper.cancel();
final PacketWrapper featuresPacket = wrapper.create(ClientboundPackets1_19_4.UPDATE_ENABLED_FEATURES); if (configurationPacketStorage.enabledFeatures() != null) {
featuresPacket.write(Type.STRING_ARRAY, configurationPacketStorage.enabledFeatures()); final PacketWrapper featuresPacket = wrapper.create(ClientboundPackets1_19_4.UPDATE_ENABLED_FEATURES);
featuresPacket.send(Protocol1_20To1_20_2.class); featuresPacket.write(Type.STRING_ARRAY, configurationPacketStorage.enabledFeatures());
featuresPacket.send(Protocol1_20To1_20_2.class);
}
configurationPacketStorage.sendQueuedPackets(wrapper.user()); configurationPacketStorage.sendQueuedPackets(wrapper.user());
}); });

Datei anzeigen

@ -29,6 +29,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class ConfigurationPacketStorage implements StorableObject { public final class ConfigurationPacketStorage implements StorableObject {
@ -51,8 +52,7 @@ public final class ConfigurationPacketStorage implements StorableObject {
this.registry = registry; this.registry = registry;
} }
public String[] enabledFeatures() { public String @Nullable [] enabledFeatures() {
Preconditions.checkNotNull(enabledFeatures);
return enabledFeatures; return enabledFeatures;
} }