woah
This commit is contained in:
parent
166d04c3ba
commit
4416018d05
|
@ -0,0 +1,11 @@
|
||||||
|
package dev.coredoes.maple.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(ClientPlayerEntity.class)
|
||||||
|
public interface ClientPlayerEntityAccessor {
|
||||||
|
@Accessor("ticksSinceLastPositionPacketSent")
|
||||||
|
void setTicksSinceLastPositionPacketSent(int ticks);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package dev.coredoes.maple.mixin;
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(PlayerMoveC2SPacket.class)
|
||||||
|
public interface PlayerMoveC2SPacketAccessor {
|
||||||
|
@Mutable
|
||||||
|
@Accessor("y")
|
||||||
|
void setY(double y);
|
||||||
|
|
||||||
|
@Mutable
|
||||||
|
@Accessor("onGround")
|
||||||
|
void setOnGround(boolean onGround);
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.coredoes.maple.mixin;
|
package dev.coredoes.maple.mixin;
|
||||||
|
|
||||||
import dev.coredoes.maple.module.BotMovement;
|
import dev.coredoes.maple.module.BotMovement;
|
||||||
|
import dev.coredoes.maple.module.NoFall;
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -21,6 +22,9 @@ public class PlayerMoveC2SPacketMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
protected double z;
|
protected double z;
|
||||||
|
|
||||||
|
@Mutable
|
||||||
|
@Shadow @Final protected boolean onGround;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
public void constructor(double x, double y, double z, float yaw, float pitch, boolean onGround, boolean changePosition, boolean changeLook, CallbackInfo ci) {
|
public void constructor(double x, double y, double z, float yaw, float pitch, boolean onGround, boolean changePosition, boolean changeLook, CallbackInfo ci) {
|
||||||
if (BotMovement.INSTANCE.isEnabled()) {
|
if (BotMovement.INSTANCE.isEnabled()) {
|
||||||
|
@ -29,5 +33,9 @@ public class PlayerMoveC2SPacketMixin {
|
||||||
this.x = Math.nextAfter(newX, newX + Math.signum(newX)); // Round x
|
this.x = Math.nextAfter(newX, newX + Math.signum(newX)); // Round x
|
||||||
this.z = Math.nextAfter(newZ, newZ + Math.signum(newZ)); // Round z
|
this.z = Math.nextAfter(newZ, newZ + Math.signum(newZ)); // Round z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NoFall.INSTANCE.isEnabled()) {
|
||||||
|
this.onGround = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package dev.coredoes.maple.gui
|
||||||
|
|
||||||
|
import imgui.ImGui
|
||||||
|
|
||||||
|
class GuiUtil {
|
||||||
|
companion object {
|
||||||
|
fun helpMarker(desc: String) {
|
||||||
|
if (ImGui.isItemHovered()) {
|
||||||
|
ImGui.beginTooltip()
|
||||||
|
ImGui.pushTextWrapPos(ImGui.getFontSize() * 35f)
|
||||||
|
ImGui.textUnformatted(desc)
|
||||||
|
ImGui.popTextWrapPos()
|
||||||
|
ImGui.endTooltip()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package dev.coredoes.maple.gui.panel
|
||||||
|
|
||||||
|
import dev.coredoes.maple.manager.ModuleManager
|
||||||
|
import imgui.ImGui
|
||||||
|
|
||||||
|
object ConfigPanel : Panel {
|
||||||
|
override fun draw() {
|
||||||
|
for (module in ModuleManager.getModules()) {
|
||||||
|
if (ImGui.treeNode(module.value.stringTitle())) {
|
||||||
|
module.value.drawConfig()
|
||||||
|
ImGui.treePop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Config"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -419284 79 765921
|
||||||
|
// -52410 79 95740
|
||||||
|
|
||||||
|
// -176 128 73
|
|
@ -4,6 +4,7 @@ import dev.coredoes.maple.Manager
|
||||||
import dev.coredoes.maple.Maple
|
import dev.coredoes.maple.Maple
|
||||||
import dev.coredoes.maple.event.MapleEvent
|
import dev.coredoes.maple.event.MapleEvent
|
||||||
import dev.coredoes.maple.gui.panel.AboutPanel
|
import dev.coredoes.maple.gui.panel.AboutPanel
|
||||||
|
import dev.coredoes.maple.gui.panel.ConfigPanel
|
||||||
import dev.coredoes.maple.gui.panel.PanelManager
|
import dev.coredoes.maple.gui.panel.PanelManager
|
||||||
import imgui.ImFontConfig
|
import imgui.ImFontConfig
|
||||||
import imgui.ImGui
|
import imgui.ImGui
|
||||||
|
@ -67,6 +68,7 @@ object GuiManager : Manager {
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
PanelManager.registerPanel(AboutPanel)
|
PanelManager.registerPanel(AboutPanel)
|
||||||
|
PanelManager.registerPanel(ConfigPanel)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stringName(): String {
|
override fun stringName(): String {
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
package dev.coredoes.maple.manager
|
package dev.coredoes.maple.manager
|
||||||
|
|
||||||
import dev.coredoes.maple.Manager
|
import dev.coredoes.maple.Manager
|
||||||
|
import dev.coredoes.maple.Maple
|
||||||
import dev.coredoes.maple.module.BotMovement
|
import dev.coredoes.maple.module.BotMovement
|
||||||
|
import dev.coredoes.maple.module.CreativeFlight
|
||||||
import dev.coredoes.maple.module.Module
|
import dev.coredoes.maple.module.Module
|
||||||
|
import dev.coredoes.maple.module.NoFall
|
||||||
|
|
||||||
object ModuleManager : Manager {
|
object ModuleManager : Manager {
|
||||||
private val modules: MutableMap<String, Module> = mutableMapOf()
|
private val modules: MutableMap<String, Module> = mutableMapOf()
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
registerModule("botmovement", BotMovement)
|
registerModule("botmovement", BotMovement)
|
||||||
|
registerModule("nofall", NoFall)
|
||||||
|
registerModule("creativeflight", CreativeFlight)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stringName(): String {
|
override fun stringName(): String {
|
||||||
|
@ -17,8 +22,10 @@ object ModuleManager : Manager {
|
||||||
|
|
||||||
fun registerModule(id: String, module: Module) {
|
fun registerModule(id: String, module: Module) {
|
||||||
modules[id] = module
|
modules[id] = module
|
||||||
|
Maple.eventManager.registerClass(module)
|
||||||
}
|
}
|
||||||
fun unregisterModule(id: String) {
|
fun unregisterModule(id: String) {
|
||||||
|
Maple.eventManager.unregisterClass(modules[id]!!)
|
||||||
modules.remove(id)
|
modules.remove(id)
|
||||||
}
|
}
|
||||||
fun enableModule(id: String) {
|
fun enableModule(id: String) {
|
||||||
|
@ -27,4 +34,7 @@ object ModuleManager : Manager {
|
||||||
fun disableModule(id: String) {
|
fun disableModule(id: String) {
|
||||||
modules[id]?.setEnabled(false)
|
modules[id]?.setEnabled(false)
|
||||||
}
|
}
|
||||||
|
fun getModules(): MutableIterator<MutableMap.MutableEntry<String, Module>> {
|
||||||
|
return modules.iterator()
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,21 @@
|
||||||
package dev.coredoes.maple.module
|
package dev.coredoes.maple.module
|
||||||
|
|
||||||
object BotMovement : Module {
|
import imgui.ImGui
|
||||||
private var enabled = true
|
import imgui.type.ImBoolean
|
||||||
|
|
||||||
override fun isEnabled(): Boolean { return enabled }
|
object BotMovement : Module {
|
||||||
|
private var enabled = ImBoolean(true)
|
||||||
|
|
||||||
|
override fun isEnabled(): Boolean { return enabled.get() }
|
||||||
override fun setEnabled(enabled: Boolean) {
|
override fun setEnabled(enabled: Boolean) {
|
||||||
this.enabled = enabled
|
this.enabled.set(enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun stringTitle(): String {
|
||||||
|
return "BotMovement"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun drawConfig() {
|
||||||
|
ImGui.checkbox("Enabled?", enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package dev.coredoes.maple.module
|
||||||
|
|
||||||
|
import dev.coredoes.maple.event.EventHandler
|
||||||
|
import dev.coredoes.maple.event.MapleEvent
|
||||||
|
import dev.coredoes.maple.gui.GuiUtil
|
||||||
|
import imgui.ImGui
|
||||||
|
import imgui.type.ImBoolean
|
||||||
|
import net.minecraft.client.MinecraftClient
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.PositionAndOnGround
|
||||||
|
import net.minecraft.util.math.Vec3d
|
||||||
|
|
||||||
|
|
||||||
|
object CreativeFlight : Module {
|
||||||
|
|
||||||
|
private var antikick = ImBoolean(true)
|
||||||
|
private var enabled = ImBoolean(true)
|
||||||
|
private var speed = floatArrayOf(0.1f)
|
||||||
|
|
||||||
|
private var fallingTicks = 0
|
||||||
|
private var lastPos: Vec3d? = null
|
||||||
|
|
||||||
|
override fun isEnabled(): Boolean { return enabled.get()}
|
||||||
|
override fun setEnabled(enabled: Boolean) {
|
||||||
|
this.enabled.set(enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun stringTitle(): String {
|
||||||
|
return "CreativeFlight"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun drawConfig() {
|
||||||
|
ImGui.checkbox("Enabled?", enabled)
|
||||||
|
|
||||||
|
ImGui.checkbox("Anti-Kick?", antikick)
|
||||||
|
GuiUtil.helpMarker("Prevent vanilla flykick")
|
||||||
|
|
||||||
|
ImGui.sliderFloat("Speed", speed, 0.0f, 1.0f)
|
||||||
|
GuiUtil.helpMarker("Your speed when flying")
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
fun onPreTick(e: MapleEvent.PreTick) {
|
||||||
|
if (MinecraftClient.getInstance().player == null) return
|
||||||
|
|
||||||
|
val flySpeed = speed
|
||||||
|
|
||||||
|
if (enabled.get()) {
|
||||||
|
MinecraftClient.getInstance().player!!.abilities.allowFlying = true
|
||||||
|
MinecraftClient.getInstance().player!!.abilities.flySpeed = flySpeed[0]
|
||||||
|
} else {
|
||||||
|
MinecraftClient.getInstance().player!!.abilities.allowFlying = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
fun onPostTick(e: MapleEvent.PostTick) {
|
||||||
|
if (MinecraftClient.getInstance().player == null) return
|
||||||
|
|
||||||
|
if (MinecraftClient.getInstance().player!!.abilities.flying) {
|
||||||
|
fallingTicks++
|
||||||
|
|
||||||
|
if (fallingTicks >= 20) {
|
||||||
|
var shouldAntikick = antikick.get()
|
||||||
|
|
||||||
|
if (MinecraftClient.getInstance().player!!.isSneaking) {
|
||||||
|
if (lastPos != null && MinecraftClient.getInstance().player!!.y < lastPos!!.getY()) shouldAntikick = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldAntikick) {
|
||||||
|
MinecraftClient.getInstance().player!!.networkHandler.sendPacket(PositionAndOnGround(
|
||||||
|
MinecraftClient.getInstance().player!!.x,
|
||||||
|
MinecraftClient.getInstance().player!!.y - 0.03126,
|
||||||
|
MinecraftClient.getInstance().player!!.z,
|
||||||
|
true
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
fallingTicks = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,4 +11,6 @@ interface Module {
|
||||||
|
|
||||||
fun isEnabled(): Boolean { return false }
|
fun isEnabled(): Boolean { return false }
|
||||||
fun setEnabled(enabled: Boolean) {}
|
fun setEnabled(enabled: Boolean) {}
|
||||||
|
fun stringTitle(): String
|
||||||
|
fun drawConfig()
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package dev.coredoes.maple.module
|
||||||
|
|
||||||
|
import imgui.ImGui
|
||||||
|
import imgui.type.ImBoolean
|
||||||
|
|
||||||
|
object NoFall : Module {
|
||||||
|
private var enabled = ImBoolean(true)
|
||||||
|
|
||||||
|
override fun isEnabled(): Boolean { return enabled.get() }
|
||||||
|
override fun setEnabled(enabled: Boolean) {
|
||||||
|
this.enabled.set(enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun stringTitle(): String {
|
||||||
|
return "NoFall"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun drawConfig() {
|
||||||
|
ImGui.checkbox("Enabled?", enabled)
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ClientConnectionMixin",
|
"ClientConnectionMixin",
|
||||||
|
"PlayerMoveC2SPacketAccessor",
|
||||||
"PlayerMoveC2SPacketMixin"
|
"PlayerMoveC2SPacketMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
},
|
},
|
||||||
"client": [
|
"client": [
|
||||||
"ClientBrandRetrieverMixin",
|
"ClientBrandRetrieverMixin",
|
||||||
|
"ClientPlayerEntityAccessor",
|
||||||
"InputUtilMixin",
|
"InputUtilMixin",
|
||||||
"KeyboardMixin",
|
"KeyboardMixin",
|
||||||
"RenderSystemMixin"
|
"RenderSystemMixin"
|
||||||
|
|
Loading…
Reference in New Issue