mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-15 10:35:14 +01:00
implements #75, remove Shadow workaround
This commit is contained in:
parent
e0a2761af2
commit
cb9c9f3cd2
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.address.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabricAddress;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -33,10 +33,10 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@Mixin(targets = "net/minecraft/client/gui/screen/ConnectScreen$1", priority = 2000) // don't know if it will work with MinerParty mod
|
||||
@Mixin(targets = "net/minecraft/client/gui/screen/ConnectScreen$1", priority = 2000)
|
||||
public class MixinConnectScreenThread {
|
||||
@Redirect(method = "run()V", at = @At(value = "INVOKE",
|
||||
target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
|
||||
target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
|
||||
private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
|
||||
ViaFabricAddress viaAddr = new ViaFabricAddress().parse(address);
|
||||
if (viaAddr.viaSuffix == null) {
|
||||
@ -46,5 +46,4 @@ public class MixinConnectScreenThread {
|
||||
InetAddress resolved = InetAddress.getByName(viaAddr.realAddress);
|
||||
return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.viaSuffix, resolved.getAddress());
|
||||
}
|
||||
|
||||
}
|
@ -23,24 +23,29 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.address.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabricAddress;
|
||||
import net.minecraft.network.ServerAddress;
|
||||
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(ServerAddress.class)
|
||||
public class MixinServerAddress {
|
||||
public abstract class MixinServerAddress {
|
||||
@Shadow private static String[] resolveSrv(String address) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Redirect(method = "parse", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ServerAddress;resolveSrv(Ljava/lang/String;)[Ljava/lang/String;"))
|
||||
private static String[] modifySrvAddr(String address) {
|
||||
ViaFabricAddress viaAddr = new ViaFabricAddress().parse(address);
|
||||
if (viaAddr.viaSuffix == null) {
|
||||
return ServerAddress.resolveSrv(address);
|
||||
return resolveSrv(address);
|
||||
}
|
||||
|
||||
String[] resolvedSrv = ServerAddress.resolveSrv(viaAddr.realAddress);
|
||||
String[] resolvedSrv = resolveSrv(viaAddr.realAddress);
|
||||
resolvedSrv[0] = resolvedSrv[0].replaceAll("\\.$", "") + "." + viaAddr.viaSuffix;
|
||||
|
||||
return resolvedSrv;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.address.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabricAddress;
|
||||
import net.minecraft.client.network.MultiplayerServerListPinger;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.debug.client;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.debug.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.gui.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.github.creeper123123321.viafabric.gui.ViaConfigScreen;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin;
|
||||
package com.github.creeper123123321.viafabric.mixin.pipeline;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.channel.ChannelHandler;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin;
|
||||
package com.github.creeper123123321.viafabric.mixin.pipeline;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import com.github.creeper123123321.viafabric.handler.serverside.FabricDecodeHandler;
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.mixin.client;
|
||||
package com.github.creeper123123321.viafabric.mixin.pipeline.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
@ -83,7 +83,10 @@
|
||||
},
|
||||
"icon": "assets/viafabric/textures/logo.png",
|
||||
"mixins": [
|
||||
"mixins.viafabric.json"
|
||||
"mixins.viafabric.address.json",
|
||||
"mixins.viafabric.gui.json",
|
||||
"mixins.viafabric.debug.json",
|
||||
"mixins.viafabric.pipeline.json"
|
||||
],
|
||||
"accessWidener": "viafabric.accesswidener"
|
||||
}
|
||||
|
15
src/main/resources/mixins.viafabric.address.json
Normal file
15
src/main/resources/mixins.viafabric.address.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "com.github.creeper123123321.viafabric.mixin.address",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.MixinConnectScreenThread",
|
||||
"client.MixinServerAddress",
|
||||
"client.MixinServerPinger"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
14
src/main/resources/mixins.viafabric.debug.json
Normal file
14
src/main/resources/mixins.viafabric.debug.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "com.github.creeper123123321.viafabric.mixin.debug",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnectionAccessor",
|
||||
"client.MixinDebugHud"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 0
|
||||
}
|
||||
}
|
13
src/main/resources/mixins.viafabric.gui.json
Normal file
13
src/main/resources/mixins.viafabric.gui.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "com.github.creeper123123321.viafabric.mixin.gui",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.MixinMultiplayerScreen"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 0
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "com.github.creeper123123321.viafabric.mixin",
|
||||
"mixins": [
|
||||
"MixinClientConnection",
|
||||
"MixinServerNetworkIoChInit"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnectionAccessor",
|
||||
"client.MixinClientConnectionChInit",
|
||||
"client.MixinConnectScreenThread",
|
||||
"client.MixinDebugHud",
|
||||
"client.MixinMultiplayerScreen",
|
||||
"client.MixinServerAddress",
|
||||
"client.MixinServerPinger"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
15
src/main/resources/mixins.viafabric.pipeline.json
Normal file
15
src/main/resources/mixins.viafabric.pipeline.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "com.github.creeper123123321.viafabric.mixin.pipeline",
|
||||
"mixins": [
|
||||
"MixinClientConnection",
|
||||
"MixinServerNetworkIoChInit"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnectionChInit"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
@ -1,4 +1,2 @@
|
||||
accessWidener v1 named
|
||||
|
||||
# @Shadow bug workaround https://github.com/FabricMC/fabric-loom/issues/279
|
||||
accessible method net/minecraft/network/ServerAddress resolveSrv (Ljava/lang/String;)[Ljava/lang/String;
|
Loading…
Reference in New Issue
Block a user