use of net.ludocrypt.limlib.api.sound.LiminalTravelSound in project Liminal-Library by LudoCrypt.
the class LiminalSoundRegistry method getCurrent.
public static Optional<SoundEvent> getCurrent(ServerWorld from, ServerWorld to) {
MutableObject<Optional<SoundEvent>> mutableSound = new MutableObject<Optional<SoundEvent>>(Optional.of(SoundEvents.BLOCK_PORTAL_TRAVEL));
Optional<LiminalTravelSound> toTravelSound = ((DimensionTypeAccess) to.getDimension()).getLiminalEffects().getTravel();
Optional<LiminalTravelSound> fromTravelSound = ((DimensionTypeAccess) from.getDimension()).getLiminalEffects().getTravel();
if (fromTravelSound.isPresent()) {
fromTravelSound.get().hookSound(from, to, mutableSound);
}
if (toTravelSound.isPresent()) {
toTravelSound.get().hookSound(from, to, mutableSound);
}
List<LiminalTravelSound> list = Lists.newArrayList(OVERRIDE_TRAVEL_SOUND.iterator());
Collections.sort(list, (a, b) -> Integer.compare(a == null ? 1000 : a.priority(), b == null ? 1000 : b.priority()));
for (LiminalTravelSound sound : list) {
sound.hookSound(from, to, mutableSound);
}
return mutableSound.getValue();
}
Aggregations