diff --git a/src/main/java/com/lambda/mixin/player/MixinEntityPlayerSP.java b/src/main/java/com/lambda/mixin/player/MixinEntityPlayerSP.java index 57e40faa7..683eaa206 100644 --- a/src/main/java/com/lambda/mixin/player/MixinEntityPlayerSP.java +++ b/src/main/java/com/lambda/mixin/player/MixinEntityPlayerSP.java @@ -3,6 +3,7 @@ import com.lambda.client.event.LambdaEventBus; import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent; import com.lambda.client.event.events.PlayerMoveEvent; +import com.lambda.client.event.events.PushOutOfBlocksEvent; import com.lambda.client.gui.mc.LambdaGuiBeacon; import com.lambda.client.manager.managers.MessageManager; import com.lambda.client.manager.managers.PlayerPacketManager; @@ -70,6 +71,15 @@ public void closeScreen(Minecraft minecraft, GuiScreen screen) { if (PortalChat.INSTANCE.isDisabled()) Wrapper.getMinecraft().displayGuiScreen(screen); } + @Inject(method = "pushOutOfBlocks", at = @At("HEAD"), cancellable = true) + private void onPushOutOfBlocks(CallbackInfoReturnable callbackInfoReturnable) { + PushOutOfBlocksEvent event = new PushOutOfBlocksEvent(); + LambdaEventBus.INSTANCE.post(event); + if (event.getCancelled()) { + callbackInfoReturnable.setReturnValue(false); + } + } + /** * @author TBM * Used with full permission from TBM - l1ving diff --git a/src/main/kotlin/com/lambda/client/event/events/PushOutOfBlocksEvent.kt b/src/main/kotlin/com/lambda/client/event/events/PushOutOfBlocksEvent.kt new file mode 100644 index 000000000..fb78968da --- /dev/null +++ b/src/main/kotlin/com/lambda/client/event/events/PushOutOfBlocksEvent.kt @@ -0,0 +1,5 @@ +package com.lambda.client.event.events + +import com.lambda.client.event.* + +class PushOutOfBlocksEvent : Event, ICancellable by Cancellable() diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/Velocity.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/Velocity.kt index e68232838..ad7c49538 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/movement/Velocity.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/Velocity.kt @@ -1,6 +1,7 @@ package com.lambda.client.module.modules.movement import com.lambda.client.event.events.PacketEvent +import com.lambda.client.event.events.PushOutOfBlocksEvent import com.lambda.client.mixin.extension.* import com.lambda.client.module.Category import com.lambda.client.module.Module @@ -31,6 +32,7 @@ object Velocity : Module( private val noPush by setting("No Push", true) private val entity by setting("Entity", true, { noPush }) private val liquid by setting("Liquid", true, { noPush }) + private val block by setting("Block", false, { noPush }) init { safeListener { @@ -57,6 +59,10 @@ object Velocity : Module( } } } + + safeListener { + if (block) it.cancel() + } } private val isZero get() = horizontal == 0.0f && vertical == 0.0f