@SubscribeEvent(priority = EventPriority.LOWEST)
  public static void onSoundEvent(PlaySoundEvent evt) {
    ISound sound = evt.getResultSound();

    if (sound != null && shouldSilence(sound)) {
      if (sound instanceof ITickableSound) {
        evt.setResultSound(new WrappedTickableSound((ITickableSound) sound, MULTIPLIER));
      } else {
        SubTileBergamute berg =
            SubTileBergamute.getBergamuteNearby(
                sound.getXPosF(), sound.getYPosF(), sound.getZPosF());

        if (berg != null) {
          evt.setResultSound(new WrappedSound(sound, MULTIPLIER));

          if (RAND.nextBoolean()) {
            Color color = TilePool.PARTICLE_COLOR;
            BotaniaAPI.internalHandler.sparkleFX(
                berg.getWorld(),
                berg.getPos().getX() + 0.3 + Math.random() * 0.5,
                berg.getPos().getY() + 0.5 + Math.random() * 0.5,
                berg.getPos().getZ() + 0.3 + Math.random() * 0.5,
                color.getRed() / 255F,
                color.getGreen() / 255F,
                color.getBlue() / 255F,
                (float) Math.random(),
                5);
          }
        }
      }
    }
  }
 @Override
 public float getVolume() {
   float mult =
       recheck && SubTileBergamute.getBergamuteNearby(getXPosF(), getYPosF(), getZPosF()) == null
           ? 1F
           : volMult;
   return compose.getVolume() * mult;
 }
 @Nullable
 @Override
 public SoundEventAccessor createAccessor(@Nonnull SoundHandler handler) {
   return compose.createAccessor(handler);
 }
 @Nonnull
 @Override
 public ResourceLocation getSoundLocation() {
   return compose.getSoundLocation();
 }
 private static boolean shouldSilence(ISound sound) {
   return sound.getCategory() != SoundCategory.VOICE
       && sound.getCategory() != SoundCategory.MUSIC
       && sound.getClass().getName().startsWith("net.minecraft.client.audio");
 }
 @Override
 public float getZPosF() {
   return compose.getZPosF();
 }
 @Nonnull
 @Override
 public AttenuationType getAttenuationType() {
   return compose.getAttenuationType();
 }
 @Override
 public float getPitch() {
   return compose.getPitch();
 }
 @Override
 public int getRepeatDelay() {
   return compose.getRepeatDelay();
 }
Exemplo n.º 10
0
 @Override
 public boolean canRepeat() {
   return compose.canRepeat();
 }
Exemplo n.º 11
0
 @Nonnull
 @Override
 public SoundCategory getCategory() {
   return compose.getCategory();
 }
Exemplo n.º 12
0
 @Nonnull
 @Override
 public Sound getSound() {
   return compose.getSound();
 }