Cancel velocity while playing songs
This commit is contained in:
parent
95df01fdc1
commit
fd2b089e90
1 changed files with 8 additions and 4 deletions
|
@ -5,10 +5,7 @@ import com.github.hhhzzzsss.songplayer.SongPlayer;
|
||||||
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
||||||
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
import net.minecraft.network.packet.s2c.play.*;
|
||||||
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
|
|
||||||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
|
|
||||||
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
@ -51,4 +48,11 @@ public class ClientPlayNetworkHandlerMixin {
|
||||||
SongPlayer.MC.player.getAbilities().flying = handler.wasFlying;
|
SongPlayer.MC.player.getAbilities().flying = handler.wasFlying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocityClient(DDD)V"), method = "onEntityVelocityUpdate", cancellable = true)
|
||||||
|
public void onOnEntityVelocityUpdate(EntityVelocityUpdateS2CPacket packet, CallbackInfo ci) {
|
||||||
|
if (!SongHandler.getInstance().isIdle() && packet.getId() == SongPlayer.MC.player.getId()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue