use of net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket in project Liminal-Library by LudoCrypt.
the class ServerPlayerEntityMixin method limlib$moveToWorld.
@Inject(method = "moveToWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 5, shift = Shift.AFTER))
public void limlib$moveToWorld(ServerWorld to, CallbackInfoReturnable<Entity> ci) {
Optional<SoundEvent> sound = LiminalSoundRegistry.getCurrent(moveToWorld$from, to);
if (sound != null) {
this.networkHandler.sendPacket(new PlaySoundS2CPacket(sound.get(), SoundCategory.AMBIENT, this.getX(), this.getY(), this.getZ(), 0.25F, world.getRandom().nextFloat() * 0.4F + 0.8F));
}
this.moveToWorld$from = null;
}
Aggregations