-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: server preview in direct connect
- Loading branch information
Showing
9 changed files
with
61 additions
and
12 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2G | |
|
||
# Define project properties. | ||
mod_name=REDACTION | ||
mod_ver=0.3.0 | ||
mod_ver=0.4.0 |
37 changes: 37 additions & 0 deletions
37
src/main/java/net/wyvest/redaction/mixin/GuiScreenServerListMixin.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.wyvest.redaction.mixin; | ||
|
||
import net.minecraft.client.gui.*; | ||
import net.minecraft.client.multiplayer.ServerData; | ||
import net.wyvest.redaction.config.RedactionConfig; | ||
import org.spongepowered.asm.mixin.Final; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(GuiScreenServerList.class) | ||
public class GuiScreenServerListMixin extends GuiScreen { | ||
@Shadow @Final private GuiScreen field_146303_a; | ||
@Shadow private GuiTextField field_146302_g; | ||
private ServerListEntryNormal serverPreview; | ||
|
||
@Inject(method = "initGui", at = @At("TAIL")) | ||
private void initServerPreview(CallbackInfo ci) { | ||
if (RedactionConfig.INSTANCE.getServerPreview()) { | ||
serverPreview = new ServerListEntryNormal(((GuiMultiplayer) field_146303_a), new ServerData("", "", false)); | ||
} | ||
} | ||
|
||
@Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiTextField;drawTextBox()V")) | ||
private void drawServerPreview(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { | ||
if (RedactionConfig.INSTANCE.getServerPreview() && serverPreview != null) { | ||
if (!serverPreview.getServerData().serverIP.equals(field_146302_g.getText())) { | ||
serverPreview.getServerData().serverIP = field_146302_g.getText(); | ||
serverPreview.getServerData().serverName = field_146302_g.getText(); | ||
serverPreview.getServerData().field_78841_f = false; | ||
} | ||
serverPreview.drawEntry(0, width / 2 - 100, 30, 200, 35, mouseX, mouseY, 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
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
public net.minecraft.client.gui.ServerListEntryNormal <init>(Lnet/minecraft/client/gui/GuiMultiplayer;Lnet/minecraft/client/multiplayer/ServerData;)V # constructor |