GOING INGAME!
This commit is contained in:
parent
21cc31fe12
commit
cfbd75b67e
2 changed files with 21 additions and 4 deletions
|
@ -5,6 +5,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.entity.MoverType;
|
import net.minecraft.entity.MoverType;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
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)
|
@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) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,14 +107,26 @@ public class MixinProxy {
|
||||||
BaseBand.publish(new MotionUpdateEvent.Post());
|
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_);
|
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();
|
ci.cancel();
|
||||||
|
return BaseBand.publish(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void minecraftOnInit() {
|
public static void minecraftOnInit() {
|
||||||
BaseBand.onInit();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue