mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-22 11:56:21 +01:00
Code cleanup
This commit is contained in:
parent
1cac6e5e16
commit
4269453a5e
@ -23,6 +23,4 @@ public interface IDownloadingTerrainScreen {
|
||||
|
||||
void viaFabricPlus$setReady();
|
||||
|
||||
boolean viaFabricPlus$isReady();
|
||||
|
||||
}
|
||||
|
@ -121,17 +121,15 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
|
||||
@Inject(method = "onPlayerSpawnPosition", at = @At("RETURN"))
|
||||
public void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_19, VersionEnum.r1_20_2)) {
|
||||
if (this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) {
|
||||
((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady();
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_19, VersionEnum.r1_20_2) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) {
|
||||
mixinDownloadingTerrainScreen.viaFabricPlus$setReady();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
|
||||
private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1) && this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) {
|
||||
((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady();
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) {
|
||||
mixinDownloadingTerrainScreen.viaFabricPlus$setReady();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID
|
||||
private int viaFabricPlus$tickCounter;
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$isReady;
|
||||
private boolean viaFabricPlus$ready;
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$closeOnNextTick = false;
|
||||
@ -73,15 +73,15 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID
|
||||
}
|
||||
} else {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady || System.currentTimeMillis() > this.loadStartTime + 2000;
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready || System.currentTimeMillis() > this.loadStartTime + 2000;
|
||||
} else {
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady;
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1)) {
|
||||
if (this.viaFabricPlus$isReady) {
|
||||
if (this.viaFabricPlus$ready) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
@ -95,14 +95,9 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean viaFabricPlus$isReady() {
|
||||
return viaFabricPlus$isReady;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viaFabricPlus$setReady() {
|
||||
viaFabricPlus$isReady = true;
|
||||
viaFabricPlus$ready = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user