Do not start generator until server responds with config

This commit is contained in:
s809
2024-08-27 16:35:22 +05:00
parent ce057525d3
commit 375cd44cbd
2 changed files with 8 additions and 8 deletions
@@ -185,7 +185,7 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
boolean isClientUsable = false, isAllowedDimension = false;
if (networkState != null)
{
isClientUsable = !networkState.getSession().isClosed();
isClientUsable = networkState.isReady();
isAllowedDimension = MC_CLIENT.getWrappedClientLevel() == this.levelWrapper;
}
@@ -34,22 +34,22 @@ public class ClientNetworkState implements Closeable
() -> Config.Client.Advanced.Logging.logNetworkEvent.get());
private final Session session = new Session(null);
private EServerSupportStatus serverSupportStatus = EServerSupportStatus.NONE;
/**
* Returns the client used by this instance. <p>
* If you need to subscribe to any packet events, create an instance of {@link ScopedNetworkEventSource} using the returned instance.
*/
public Session getSession() { return this.session; }
public MultiplayerConfig config = new MultiplayerConfig();
private volatile boolean configReceived = false;
private final MultiplayerConfigChangeListener configChangeListener = new MultiplayerConfigChangeListener(this::sendConfigMessage);
public boolean isReady() { return this.configReceived; }
private EServerSupportStatus serverSupportStatus = EServerSupportStatus.NONE;
/** Protocol version closest to supported by this mod version */
@Nullable
private Integer closestProtocolVersion;
/**
* Returns the client used by this instance. <p>
* If you need to subscribe to any packet events, create an instance of {@link ScopedNetworkEventSource} using the returned instance.
*/
public Session getSession() { return this.session; }
private final ConcurrentMap<Integer, CompositeByteBuf> fullDataBuffers = CacheBuilder.newBuilder()
.expireAfterAccess(10, TimeUnit.SECONDS)