use of me.dustin.jex.event.player.EventExplosionVelocity in project JexClient by DustinRepo.
the class MixinClientPlayNetworkHandler method onExplosion.
@Inject(method = "onExplosion", at = @At("HEAD"), cancellable = true)
public void onExplosion(ExplosionS2CPacket packet, CallbackInfo ci) {
if (isBotHandler())
return;
NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this, Wrapper.INSTANCE.getMinecraft());
Explosion explosion = new Explosion(Wrapper.INSTANCE.getMinecraft().world, (Entity) null, packet.getX(), packet.getY(), packet.getZ(), packet.getRadius(), packet.getAffectedBlocks());
explosion.affectWorld(true);
EventExplosionVelocity eventExplosionVelocity = new EventExplosionVelocity().run();
if (!eventExplosionVelocity.isCancelled())
Wrapper.INSTANCE.getLocalPlayer().setVelocity(Wrapper.INSTANCE.getLocalPlayer().getVelocity().add((double) packet.getPlayerVelocityX() * eventExplosionVelocity.getMultX(), (double) packet.getPlayerVelocityY() * eventExplosionVelocity.getMultY(), (double) packet.getPlayerVelocityZ() * eventExplosionVelocity.getMultZ()));
ci.cancel();
}
Aggregations