This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
89 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/java/io/izzel/lightfall/client/bridge/ClientLoginNetHandlerBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package io.izzel.lightfall.client.bridge; | ||
|
||
import net.minecraft.client.network.play.ClientPlayNetHandler; | ||
|
||
import net.minecraft.client.multiplayer.ClientPacketListener; | ||
|
||
public interface ClientLoginNetHandlerBridge { | ||
|
||
void bridge$reusePlayHandler(ClientPlayNetHandler handler); | ||
void bridge$reusePlayHandler(ClientPacketListener handler); | ||
} |
57 changes: 39 additions & 18 deletions
57
src/main/java/io/izzel/lightfall/client/gui/LightfallHandshakeScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,65 @@ | ||
package io.izzel.lightfall.client.gui; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.DialogTexts; | ||
import net.minecraft.client.gui.screen.MainMenuScreen; | ||
import net.minecraft.client.gui.screen.MultiplayerScreen; | ||
import net.minecraft.client.gui.screen.WorkingScreen; | ||
import net.minecraft.client.gui.widget.button.Button; | ||
import net.minecraft.network.NetworkManager; | ||
import net.minecraft.util.text.TranslationTextComponent; | ||
import net.minecraft.client.gui.chat.NarratorChatListener; | ||
import net.minecraft.client.gui.components.Button; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.gui.screens.TitleScreen; | ||
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; | ||
import net.minecraft.network.Connection; | ||
import net.minecraft.network.chat.CommonComponents; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class LightfallHandshakeScreen extends WorkingScreen { | ||
public class LightfallHandshakeScreen extends Screen { | ||
|
||
private final NetworkManager networkManager; | ||
private final Connection networkManager; | ||
private Component component; | ||
|
||
public LightfallHandshakeScreen(NetworkManager netManager) { | ||
public LightfallHandshakeScreen(Connection netManager) { | ||
super(NarratorChatListener.NO_TITLE); | ||
this.networkManager = netManager; | ||
} | ||
|
||
@Override | ||
public void tick() { | ||
if (this.networkManager.isChannelOpen()) { | ||
if (this.networkManager.isConnected()) { | ||
this.networkManager.tick(); | ||
} else { | ||
this.networkManager.handleDisconnection(); | ||
if (Minecraft.getInstance().currentScreen == this) { | ||
Minecraft.getInstance().displayGuiScreen(new MultiplayerScreen(new MainMenuScreen())); | ||
if (Minecraft.getInstance().screen == this) { | ||
Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(new TitleScreen())); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
this.displaySavingString(new TranslationTextComponent("connect.connecting")); | ||
this.addButton( | ||
new Button(this.width / 2 - 100, this.height / 4 + 120 + 12, 200, 20, DialogTexts.GUI_CANCEL, | ||
this.addRenderableWidget( | ||
new Button(this.width / 2 - 100, this.height / 4 + 120 + 12, 200, 20, CommonComponents.GUI_CANCEL, | ||
button -> { | ||
this.networkManager.closeChannel(new TranslationTextComponent("connect.aborted")); | ||
this.minecraft.displayGuiScreen(new MultiplayerScreen(new MainMenuScreen())); | ||
this.networkManager.disconnect(new TranslatableComponent("connect.aborted")); | ||
this.minecraft.setScreen(new JoinMultiplayerScreen(new TitleScreen())); | ||
} | ||
) | ||
); | ||
} | ||
|
||
public void setComponent(Component component) { | ||
this.component = component; | ||
} | ||
|
||
public void render(@NotNull PoseStack poseStack, int p_96531_, int p_96532_, float p_96533_) { | ||
this.renderDirtBackground(0); | ||
drawCenteredString(poseStack, this.font, component != null ? component : new TranslatableComponent("connect.connecting"), | ||
this.width / 2, this.height / 2 - 50, 16777215); | ||
super.render(poseStack, p_96531_, p_96532_, p_96533_); | ||
} | ||
|
||
@Override | ||
public boolean shouldCloseOnEsc() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/java/io/izzel/lightfall/client/mixin/MinecraftMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
package io.izzel.lightfall.client.mixin; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.entity.player.ClientPlayerEntity; | ||
import net.minecraft.client.world.ClientWorld; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(Minecraft.class) | ||
public class MinecraftMixin { | ||
|
||
@Shadow public ClientPlayerEntity player; | ||
|
||
@Redirect(method = "getBackgroundMusicSelector", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;world:Lnet/minecraft/client/world/ClientWorld;")) | ||
private ClientWorld lightfall$usePlayerWorld(Minecraft minecraft) { | ||
return (ClientWorld) this.player.world; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"pack": { | ||
"description": "lightfallclient resources", | ||
"pack_format": 4, | ||
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." | ||
"pack_format": 8 | ||
} | ||
} |