add config system and window dragging
This commit is contained in:
parent
6e584de0e6
commit
a18cb2a137
22 changed files with 354 additions and 104 deletions
|
@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||
import me.kawaiizenbo.moonlight.module.Module_;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -14,12 +15,30 @@ import net.minecraft.util.math.Vec3d;
|
|||
@Mixin(ClientPlayerEntity.class)
|
||||
public class ClientPlayerEntityMixin
|
||||
{
|
||||
@Inject(method = "move", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void onMotion(MovementType type, Vec3d movement, CallbackInfo ci)
|
||||
@Inject(method = "move", at = @At(value = "TAIL"), cancellable = true)
|
||||
public void onMove(MovementType type, Vec3d movement, CallbackInfo ci)
|
||||
{
|
||||
for (Module_ m : ModuleManager.INSTANCE.getEnabledModules())
|
||||
{
|
||||
m.onMotion(type, movement);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void onTick(CallbackInfo ci)
|
||||
{
|
||||
for (Module_ m : ModuleManager.INSTANCE.getEnabledModules())
|
||||
{
|
||||
if (MinecraftClient.getInstance().player != null) m.tick();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At(value = "TAIL"), cancellable = true)
|
||||
public void onInit(CallbackInfo ci)
|
||||
{
|
||||
for (Module_ m : ModuleManager.INSTANCE.getEnabledModules())
|
||||
{
|
||||
m.onEnable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package me.kawaiizenbo.moonlight.mixin;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import me.kawaiizenbo.moonlight.module.Module_;
|
||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
|
||||
|
||||
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(LivingEntity.class)
|
||||
public class LivingEntityMixin
|
||||
{
|
||||
@Inject(at = @At("HEAD"), method = "tick()V")
|
||||
private void init(CallbackInfo info)
|
||||
{
|
||||
for (Module_ mod : ModuleManager.INSTANCE.getEnabledModules())
|
||||
{
|
||||
if (MinecraftClient.getInstance().player != null) mod.tick();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package me.kawaiizenbo.moonlight.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import me.kawaiizenbo.moonlight.Moonlight;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MinecraftClientMixin
|
||||
{
|
||||
@Inject(at = @At("TAIL"), method = "scheduleStop")
|
||||
public void onShutdown(CallbackInfo ci) {
|
||||
Moonlight.INSTANCE.saveConfig();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue