Skip to content
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

Make PreMotionEvent and PostMotionEvent work with vehicles (fixes #475) #476

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java
Expand Up @@ -12,6 +12,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -106,14 +107,21 @@ private boolean wurstIsUsingItem(ClientPlayerEntity player)
return player.isUsingItem();
}

@Inject(at = {@At("HEAD")}, method = {"sendMovementPackets()V"})
private void onSendMovementPacketsHEAD(CallbackInfo ci)
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;tick()V",
ordinal = 0,
shift = Shift.AFTER), method = "tick()V")
private void onSendMovementPacketsBefore(CallbackInfo ci)
{
EventManager.fire(PreMotionEvent.INSTANCE);
}

@Inject(at = {@At("TAIL")}, method = {"sendMovementPackets()V"})
private void onSendMovementPacketsTAIL(CallbackInfo ci)
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendMovementPackets()V",
ordinal = 0,
shift = Shift.BY,
by = 2), method = "tick()V")
private void onSendMovementPacketsAfter(CallbackInfo ci)
{
EventManager.fire(PostMotionEvent.INSTANCE);
}
Expand Down