use of org.valkyrienskies.mod.fixes.SoundFixWrapper in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EventsClient method onPlaySoundEvent.
@SubscribeEvent
public void onPlaySoundEvent(PlaySoundEvent event) {
if (Minecraft.getMinecraft().world != null) {
ISound sound = event.getSound();
BlockPos pos = new BlockPos(sound.getXPosF(), sound.getYPosF(), sound.getZPosF());
Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysoManagingBlock(Minecraft.getMinecraft().world, pos);
if (physicsObject.isPresent()) {
Vector3d newSoundLocation = new Vector3d(sound.getXPosF(), sound.getYPosF(), sound.getZPosF());
physicsObject.get().getShipTransformationManager().getCurrentTickTransform().transformPosition(newSoundLocation, TransformType.SUBSPACE_TO_GLOBAL);
SoundFixWrapper soundFix = new SoundFixWrapper(sound, newSoundLocation);
event.setResultSound(soundFix);
}
}
}
Aggregations