Skip to content

Commit d459408

Browse files
committed
velocity "pushed" setting to prevent the player from being pushed by other entities
1 parent ad22b76 commit d459408

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
import com.lambda.event.EventFlow;
2222
import com.lambda.event.events.MovementEvent;
2323
import com.lambda.interaction.request.rotating.RotationManager;
24+
import com.lambda.module.modules.movement.Velocity;
2425
import com.lambda.module.modules.render.ViewModel;
26+
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
27+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
28+
import net.minecraft.client.network.ClientPlayerEntity;
29+
import net.minecraft.entity.Entity;
2530
import net.minecraft.entity.LivingEntity;
2631
import net.minecraft.util.math.MathHelper;
2732
import net.minecraft.util.math.Vec3d;
@@ -167,4 +172,12 @@ private int getHandSwingDuration(int constant) {
167172

168173
return ViewModel.INSTANCE.getSwingDuration();
169174
}
175+
176+
@WrapMethod(method = "pushAwayFrom")
177+
private void wrapPushAwayFrom(Entity entity, Operation<Void> original) {
178+
if (((Entity) ((Object) this)) instanceof ClientPlayerEntity &&
179+
Velocity.INSTANCE.isEnabled() &&
180+
Velocity.getPushed()) return;
181+
original.call(entity);
182+
}
170183
}

src/main/kotlin/com/lambda/module/modules/movement/Velocity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ object Velocity : Module(
2828
description = "Modifies your velocity",
2929
tag = ModuleTag.MOVEMENT,
3030
) {
31-
private val knockback by setting("Knockback", true)
32-
33-
@JvmStatic val explosion by setting("Explosion", true)
31+
@JvmStatic val pushed by setting("Pushed", true, "Prevents the player from getting pushed by other entities")
32+
private val knockback by setting("Knockback", true, "Prevents the player from taking knockback when being attacked")
33+
@JvmStatic val explosion by setting("Explosion", true, "Prevents the player from taking knockback from explosions")
3434

3535
init {
3636
listen<PacketEvent.Receive.Pre> { event ->

0 commit comments

Comments
 (0)