コード例 #1
0
  @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);
          }
        }
      }
    }
  }
コード例 #2
0
 @Override
 public float getVolume() {
   float mult =
       recheck && SubTileBergamute.getBergamuteNearby(getXPosF(), getYPosF(), getZPosF()) == null
           ? 1F
           : volMult;
   return compose.getVolume() * mult;
 }