mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-18 15:47:46 +01:00
implements #75, remove Shadow workaround
This commit is contained in:
parent
7a74f411a4
commit
e463c2bfb8
@ -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,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 com.mojang.datafixers.util.Pair;
|
||||
@ -35,13 +35,18 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ServerAddress.class)
|
||||
public abstract class MixinServerAddress {
|
||||
@Shadow
|
||||
private static Pair<String, Integer> resolveServer(String address) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Redirect(method = "parse", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ServerAddress;resolveServer(Ljava/lang/String;)Lcom/mojang/datafixers/util/Pair;"))
|
||||
private static Pair<String, Integer> modifySrvAddr(String address) {
|
||||
ViaFabricAddress viaAddr = new ViaFabricAddress().parse(address);
|
||||
if (viaAddr.viaSuffix == null) {
|
||||
return ServerAddress.resolveServer(address);
|
||||
return resolveServer(address);
|
||||
}
|
||||
|
||||
return ServerAddress.resolveServer(viaAddr.realAddress).mapFirst(it -> it.replaceAll("\\.$", "") + "." + viaAddr.viaSuffix);
|
||||
return resolveServer(viaAddr.realAddress).mapFirst(it -> it.replaceAll("\\.$", "") + "." + viaAddr.viaSuffix);
|
||||
}
|
||||
}
|
@ -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 resolveServer (Ljava/lang/String;)Lcom/mojang/datafixers/util/Pair;
|
Loading…
Reference in New Issue
Block a user