GOING INGAME!
All checks were successful
/ Build BaseBand Loader (push) Successful in 3m37s
/ Build BaseBand Server (push) Successful in 2m26s
/ Build BaseBand DSM & Broadway (push) Successful in 3m27s

This commit is contained in:
Daniella / Tove 2024-06-10 07:34:19 +02:00
parent 21cc31fe12
commit cfbd75b67e
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 21 additions and 4 deletions

View file

@ -5,6 +5,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.MoverType;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -64,7 +65,11 @@ public class MixinEntityPlayerSP extends AbstractClientPlayer {
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;move(Lnet/minecraft/entity/MoverType;DDD)V"), cancellable = true)
public void move(MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
MixinProxy.onMove(this, p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_, ci);
Object e = MixinProxy.onMove(p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_, ci);
if(!MixinProxy.MoveEventProxy.isCancelled(e)) {
Vec3d vec = MixinProxy.MoveEventProxy.getVec(e);
super.move(MixinProxy.MoveEventProxy.getType(e), vec.x, vec.y, vec.z);
}
}
}

View file

@ -107,14 +107,26 @@ public class MixinProxy {
BaseBand.publish(new MotionUpdateEvent.Post());
}
public static void onMove(AbstractClientPlayer p, MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
public static Object onMove(MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
MoveEvent event = new MoveEvent(p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_);
if(!BaseBand.publish(event).isCancelled())
p.move(event.type, event.x, event.y, event.z);
ci.cancel();
return BaseBand.publish(event);
}
public static void minecraftOnInit() {
BaseBand.onInit();
}
public static class MoveEventProxy {
public static boolean isCancelled(Object e) {
return ((com.baseband.client.event.events.MoveEvent) e).isCancelled();
}
public static MoverType getType(Object e) {
return ((com.baseband.client.event.events.MoveEvent) e).type;
}
public static Vec3d getVec(Object e) {
com.baseband.client.event.events.MoveEvent ev = (com.baseband.client.event.events.MoveEvent) e;
return new Vec3d(ev.x, ev.y, ev.z);
}
}
}