diff --git a/src/main/java/net/raphimc/viaproxy/ViaProxy.java b/src/main/java/net/raphimc/viaproxy/ViaProxy.java
index 64e060a..7e26a1e 100644
--- a/src/main/java/net/raphimc/viaproxy/ViaProxy.java
+++ b/src/main/java/net/raphimc/viaproxy/ViaProxy.java
@@ -81,7 +81,6 @@ public class ViaProxy {
final IClassProvider classProvider = new GuavaClassPathProvider();
final TransformerManager transformerManager = new TransformerManager(classProvider);
transformerManager.addTransformerPreprocessor(new MixinsTranslator());
- transformerManager.addTransformer("net.raphimc.viaproxy.injection.transformer.**");
transformerManager.addTransformer("net.raphimc.viaproxy.injection.mixins.**");
if (instrumentation != null) {
transformerManager.hookInstrumentation(instrumentation);
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/C2SHandshakePacketTransformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinC2SHandshakePacket.java
similarity index 68%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/C2SHandshakePacketTransformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinC2SHandshakePacket.java
index fff63a0..a6ee9fb 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/C2SHandshakePacketTransformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinC2SHandshakePacket.java
@@ -15,17 +15,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.CModifyConstant;
import net.raphimc.netminecraft.packet.impl.handshake.C2SHandshakePacket;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.Constant;
+import org.spongepowered.asm.mixin.injection.ModifyConstant;
-@CTransformer(C2SHandshakePacket.class)
-public abstract class C2SHandshakePacketTransformer {
+@Mixin(C2SHandshakePacket.class)
+public abstract class MixinC2SHandshakePacket {
- @CModifyConstant(method = "read", intValue = 255)
- private int allowLargerHostnames() {
+ @ModifyConstant(method = "read", constant = @Constant(intValue = 255))
+ private int allowLargerHostnames(int constant) {
return Short.MAX_VALUE;
}
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/ConfigTransformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinConfig.java
similarity index 69%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/ConfigTransformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinConfig.java
index 5a9d2c3..3b974da 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/ConfigTransformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinConfig.java
@@ -15,20 +15,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
import com.viaversion.viaversion.util.Config;
-import net.lenni0451.classtransform.annotations.CTarget;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.CRedirect;
import net.raphimc.viaproxy.protocolhack.ConfigPatcher;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Map;
-@CTransformer(Config.class)
-public abstract class ConfigTransformer {
+@Mixin(Config.class)
+public abstract class MixinConfig {
- @CRedirect(method = "loadConfig(Ljava/io/File;Ljava/net/URL;)Ljava/util/Map;", target = @CTarget(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z"))
+ @Redirect(method = "loadConfig(Ljava/io/File;Ljava/net/URL;)Ljava/util/Map;", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z"))
private boolean allowConfigPatching(final Map map, final Object key) {
if (((Object) this) instanceof ConfigPatcher) {
return true;
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/Protocol1_18_2To1_18Transformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinProtocol1_18_2To1_18.java
similarity index 82%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/Protocol1_18_2To1_18Transformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinProtocol1_18_2To1_18.java
index 7581094..85c51f6 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/Protocol1_18_2To1_18Transformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinProtocol1_18_2To1_18.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
@@ -24,15 +24,15 @@ import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
-import net.lenni0451.classtransform.annotations.CTarget;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.CInject;
import net.raphimc.viaproxy.protocolhack.viaproxy.loading_terrain_fix.SpawnPositionTracker;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
-@CTransformer(Protocol1_18_2To1_18.class)
-public abstract class Protocol1_18_2To1_18Transformer extends AbstractProtocol {
+@Mixin(Protocol1_18_2To1_18.class)
+public abstract class MixinProtocol1_18_2To1_18 extends AbstractProtocol {
- @CInject(method = "registerPackets", target = @CTarget("RETURN"))
+ @Inject(method = "registerPackets", at = @At("RETURN"))
private void fixDownloadingTerrainScreenNotClosing() {
this.registerClientbound(ClientboundPackets1_18.PLAYER_POSITION, new PacketHandlers() {
@Override
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/UserConnectionImplTransformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinUserConnectionImpl.java
similarity index 59%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/UserConnectionImplTransformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinUserConnectionImpl.java
index 7eef642..8c53de4 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/UserConnectionImplTransformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinUserConnectionImpl.java
@@ -15,20 +15,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
import com.viaversion.viaversion.connection.UserConnectionImpl;
-import net.lenni0451.classtransform.InjectionCallback;
-import net.lenni0451.classtransform.annotations.CTarget;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.CInject;
+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.CallbackInfoReturnable;
-@CTransformer(UserConnectionImpl.class)
-public abstract class UserConnectionImplTransformer {
+@Mixin(UserConnectionImpl.class)
+public abstract class MixinUserConnectionImpl {
- @CInject(method = "shouldApplyBlockProtocol", target = @CTarget("HEAD"), cancellable = true)
- private void applyBlockProtocol(InjectionCallback ic) {
- ic.setReturnValue(true);
+ @Inject(method = "shouldApplyBlockProtocol", at = @At("HEAD"), cancellable = true)
+ private void applyBlockProtocol(final CallbackInfoReturnable cir) {
+ cir.setReturnValue(true);
}
}
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/ViaLegacyConfigTransformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinViaLegacyConfig.java
similarity index 55%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/ViaLegacyConfigTransformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinViaLegacyConfig.java
index 8e0fd50..0f29705 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/ViaLegacyConfigTransformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinViaLegacyConfig.java
@@ -15,29 +15,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
-import net.lenni0451.classtransform.InjectionCallback;
-import net.lenni0451.classtransform.annotations.CTarget;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.CInject;
import net.raphimc.vialegacy.ViaLegacyConfig;
import net.raphimc.viaproxy.cli.options.Options;
+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.CallbackInfoReturnable;
-@CTransformer(ViaLegacyConfig.class)
-public abstract class ViaLegacyConfigTransformer {
+@Mixin(ViaLegacyConfig.class)
+public abstract class MixinViaLegacyConfig {
- @CInject(method = "isLegacySkinLoading", target = @CTarget("HEAD"), cancellable = true)
- private void makeGUIConfigurable1(final InjectionCallback ic) {
+ @Inject(method = "isLegacySkinLoading", at = @At("HEAD"), cancellable = true)
+ private void makeGUIConfigurable1(final CallbackInfoReturnable cir) {
if (Options.LEGACY_SKIN_LOADING != null) {
- ic.setReturnValue(Options.LEGACY_SKIN_LOADING);
+ cir.setReturnValue(Options.LEGACY_SKIN_LOADING);
}
}
- @CInject(method = "isLegacySkullLoading", target = @CTarget("HEAD"), cancellable = true)
- private void makeGUIConfigurable2(final InjectionCallback ic) {
+ @Inject(method = "isLegacySkullLoading", at = @At("HEAD"), cancellable = true)
+ private void makeGUIConfigurable2(final CallbackInfoReturnable cir) {
if (Options.LEGACY_SKIN_LOADING != null) {
- ic.setReturnValue(Options.LEGACY_SKIN_LOADING);
+ cir.setReturnValue(Options.LEGACY_SKIN_LOADING);
}
}
diff --git a/src/main/java/net/raphimc/viaproxy/injection/transformer/YggdrasilServicesKeyInfoTransformer.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinYggdrasilServicesKeyInfo.java
similarity index 81%
rename from src/main/java/net/raphimc/viaproxy/injection/transformer/YggdrasilServicesKeyInfoTransformer.java
rename to src/main/java/net/raphimc/viaproxy/injection/mixins/MixinYggdrasilServicesKeyInfo.java
index 57d0e6a..0253392 100644
--- a/src/main/java/net/raphimc/viaproxy/injection/transformer/YggdrasilServicesKeyInfoTransformer.java
+++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinYggdrasilServicesKeyInfo.java
@@ -15,21 +15,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaproxy.injection.transformer;
+package net.raphimc.viaproxy.injection.mixins;
import com.mojang.authlib.yggdrasil.ServicesKeyInfo;
import com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo;
-import net.lenni0451.classtransform.annotations.CTransformer;
-import net.lenni0451.classtransform.annotations.injection.COverride;
import net.lenni0451.reflect.stream.RStream;
import net.raphimc.netminecraft.netty.crypto.CryptUtil;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Overwrite;
import java.security.PublicKey;
-@CTransformer(YggdrasilServicesKeyInfo.class)
-public abstract class YggdrasilServicesKeyInfoTransformer {
+@Mixin(YggdrasilServicesKeyInfo.class)
+public abstract class MixinYggdrasilServicesKeyInfo {
- @COverride
+ @Overwrite
public static ServicesKeyInfo createFromResources() {
try {
return RStream.of(YggdrasilServicesKeyInfo.class).constructors().by(PublicKey.class).newInstance(CryptUtil.MOJANG_PUBLIC_KEY);