Move My Injection Base to My Package, Remove useless Print in MixinNetworkManagerChInit, Add "Reconnect" button to GuiDisconnected

This commit is contained in:
FlorianMichael 2021-02-21 22:03:20 +01:00
parent cb5d1b5079
commit 4a233042bb
13 changed files with 38 additions and 16 deletions

View File

@ -35,7 +35,7 @@ repositories {
}
version = "b1"
group = "com.github.creeper123123321"
group = "de.flori2007.viaforge"
archivesBaseName = "ViaForge"
sourceCompatibility = JavaVersion.VERSION_1_8
@ -97,7 +97,7 @@ jar {
"MixinConfigs": "mixins.viaforge.json",
"tweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": 0,
"FMLCorePluginContainsFMLMod": "com.github.creeper123123321.viafabric.injection.MixinLoader"
"FMLCorePluginContainsFMLMod": "de.flori2007.viaforge.injection.MixinLoader"
)
}

View File

@ -50,6 +50,7 @@ import java.util.logging.Logger;
public class ViaFabric {
public static int clientSideVersion = 340;
public static String lastServer = "";
public static final Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
public static final ExecutorService ASYNC_EXECUTOR;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection;
package de.flori2007.viaforge.injection;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import org.spongepowered.asm.launch.MixinBootstrap;

View File

@ -0,0 +1,17 @@
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import net.minecraft.client.multiplayer.GuiConnecting;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GuiConnecting.class)
public abstract class MixinGuiConnecting {
@Inject(method = "connect", at = @At("HEAD"))
public void injectConnect(String ip, int port, CallbackInfo ci) {
ViaFabric.lastServer = ip + ":" + port;
}
}

View File

@ -1,11 +1,11 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.util.ProtocolUtils;
import de.flori2007.viaforge.gui.GuiProtocolSelector;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.*;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -18,12 +18,16 @@ public abstract class MixinGuiDisconnected extends GuiScreen {
public void injectInitGui(CallbackInfo ci) {
buttonList.add(new GuiButton(1337, 5, 6, 98, 20,
ProtocolUtils.getProtocolName(ViaFabric.clientSideVersion)));
buttonList.add(new GuiButton(1338, 5, 28, 98, 20, "Reconnect"));
}
@Inject(method = "actionPerformed", at = @At("RETURN"))
public void injectActionPerformed(GuiButton p_actionPerformed_1_, CallbackInfo ci) {
if (p_actionPerformed_1_.id == 1337)
mc.displayGuiScreen(new GuiProtocolSelector(this));
else if (p_actionPerformed_1_.id == 1338)
mc.displayGuiScreen(new GuiConnecting(new GuiMultiplayer(new GuiMainMenu()), mc,
new ServerData(ViaFabric.lastServer, ViaFabric.lastServer, false)));
}
@Inject(method = "drawScreen", at = @At("RETURN"))

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.util.ProtocolUtils;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.util.ProtocolUtils;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.util.ProtocolUtils;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.util.ProtocolUtils;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.ViaFabric;
import net.minecraft.client.Minecraft;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.channel.ChannelHandler;

View File

@ -1,4 +1,4 @@
package com.github.creeper123123321.viafabric.injection.mixins;
package de.flori2007.viaforge.injection.mixins;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
@ -27,7 +27,6 @@ public abstract class MixinNetworkManagerChInit {
channel.pipeline()
.addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new VREncodeHandler(user))
.addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new VRDecodeHandler(user));
System.out.println("aaaa");
}
}
}

View File

@ -1,9 +1,10 @@
{
"required": true,
"package": "com.github.creeper123123321.viafabric.injection.mixins",
"package": "de.flori2007.viaforge.injection.mixins",
"refmap": "mixins.viaforge.refmap.json",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinGuiConnecting",
"MixinGuiDisconnected",
"MixinGuiMainMenu",
"MixinGuiMultiplayer",