-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
660fff6
commit 8368f68
Showing
5 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/top/hendrixshen/tweakmyclient/compat/meteor/MeteorHelper.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 top.hendrixshen.tweakmyclient.compat.meteor; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
public class MeteorHelper { | ||
private static Method isNoSlowMethod; | ||
private static Object noSlowInstance; | ||
|
||
static { | ||
try { | ||
Class<?> meteorModules = Class.forName("meteordevelopment.meteorclient.systems.modules.Modules"); | ||
Method getMeteorModulesMethod = meteorModules.getDeclaredMethod("get"); | ||
getMeteorModulesMethod.setAccessible(true); | ||
Object meteorModulesInstance = getMeteorModulesMethod.invoke(null); | ||
Method getModuleMethod = meteorModules.getDeclaredMethod("get", Class.class); | ||
Class<?> noSlowClass = Class.forName("meteordevelopment.meteorclient.systems.modules.movement.NoSlow"); | ||
getModuleMethod.setAccessible(true); | ||
MeteorHelper.noSlowInstance = getModuleMethod.invoke(meteorModulesInstance, noSlowClass); | ||
MeteorHelper.isNoSlowMethod = noSlowClass.getDeclaredMethod("items"); | ||
MeteorHelper.isNoSlowMethod.setAccessible(true); | ||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static boolean isNoSlowdownHackEnable() { | ||
if (MeteorHelper.noSlowInstance != null) { | ||
try { | ||
return (boolean) MeteorHelper.isNoSlowMethod.invoke(MeteorHelper.noSlowInstance); | ||
} catch (IllegalAccessException | InvocationTargetException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/top/hendrixshen/tweakmyclient/compat/meteor/mixin/MixinLocalPlayer.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,42 @@ | ||
package top.hendrixshen.tweakmyclient.compat.meteor.mixin; | ||
|
||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import top.hendrixshen.magiclib.dependency.annotation.Dependencies; | ||
import top.hendrixshen.magiclib.dependency.annotation.Dependency; | ||
import top.hendrixshen.tweakmyclient.compat.meteor.MeteorHelper; | ||
import top.hendrixshen.tweakmyclient.compat.wurst.WurstHelper; | ||
import top.hendrixshen.tweakmyclient.config.Configs; | ||
import top.hendrixshen.tweakmyclient.util.mixin.MixinType; | ||
import top.hendrixshen.tweakmyclient.util.mixin.annotation.MagicAttack; | ||
import top.hendrixshen.tweakmyclient.util.mixin.annotation.MagicInterruption; | ||
|
||
@MagicInterruption(targets = "meteordevelopment.meteorclient.mixin.ClientPlayerEntityMixin") | ||
@Dependencies(and = @Dependency(value = "meteor-client")) | ||
@Mixin(value = LocalPlayer.class, priority = 1100) | ||
public abstract class MixinLocalPlayer extends LivingEntity { | ||
@Shadow | ||
private boolean startedUsingItem; | ||
|
||
protected MixinLocalPlayer(EntityType<? extends LivingEntity> entityType, Level level) { | ||
super(entityType, level); | ||
} | ||
|
||
@MagicAttack( | ||
type = MixinType.REDIRECT, | ||
name = "wurstIsUsingItem", | ||
owner = "class_1309", | ||
method = "method_6007", | ||
desc = "()V" | ||
) | ||
private boolean tmc$getUsingItemState(LocalPlayer instance) { | ||
if (Configs.disableSlowdown || MeteorHelper.isNoSlowdownHackEnable()) { | ||
return false; | ||
} | ||
return this.startedUsingItem; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/resources/tweakmyclient-compat-meteor.mixins.json
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,15 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "top.hendrixshen.tweakmyclient.compat.meteor.mixin", | ||
"plugin": "top.hendrixshen.tweakmyclient.compat.CompatMixinPlugin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
], | ||
"client": [ | ||
"MixinLocalPlayer" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |