Skip to content

ElytraFastClose module #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/com/lambda/mixin/accessor/AccessorEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(Entity.class)
public interface AccessorEntity {

@Accessor("isInWeb")
boolean getIsInWeb();

@Invoker("setFlag")
void invokeSetFlag(int flag, boolean set);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.lambda.client.module.modules.movement

import com.lambda.client.module.Category
import com.lambda.client.module.Module
import com.lambda.client.util.threads.safeListener
import com.lambda.mixin.accessor.AccessorEntity
import net.minecraft.network.play.client.CPacketPlayer
import net.minecraftforge.fml.common.gameevent.TickEvent

object ElytraFastClose : Module(
name = "ElytraFastClose",
description = "Closes elytra on ground without waiting for the server",
category = Category.MOVEMENT
) {
private val stopMotion by setting("Stop Motion", true)
private val yThreshold by setting ("Y Distance", 0.05, 0.0..1.0, 0.01)

init {
safeListener<TickEvent.ClientTickEvent> {
if (it.phase != TickEvent.Phase.START || !player.isElytraFlying) return@safeListener
if (world.collidesWithAnyBlock(player.entityBoundingBox.offset(0.0, -yThreshold, 0.0))) {
if (stopMotion) {
player.motionX = 0.0
player.motionY = 0.0
player.motionZ = 0.0
}
(player as AccessorEntity).invokeSetFlag(7, false)
connection.sendPacket(CPacketPlayer(true))
}
}
}

}