From 07ce6eb7745d5a958361ee87240318c102a4c88f Mon Sep 17 00:00:00 2001 From: LemADEC Date: Sun, 5 Mar 2017 11:08:52 +0100 Subject: [PATCH] Improved cloaking core and force field projector sound effects --- .../block/detection/TileEntityCloakingCore.java | 9 ++++++--- .../block/forcefield/TileEntityForceFieldProjector.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java index 87f04583..bf21a58b 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java @@ -24,6 +24,9 @@ import cpw.mods.fml.common.Optional; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityCloakingCore extends TileEntityAbstractEnergy { + + private static final int CLOAKING_CORE_SOUND_UPDATE_TICKS = 40; + public boolean isEnabled = false; public byte tier = 1; // cloaking field tier, 1 or 2 @@ -71,9 +74,9 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { } // Reset sound timer - soundTicks++; - if (soundTicks >= 40) { - soundTicks = 0; + soundTicks--; + if (soundTicks < 0) { + soundTicks = CLOAKING_CORE_SOUND_UPDATE_TICKS; soundPlayed = false; } diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java index f42d914e..40e9b34c 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java @@ -213,7 +213,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField } soundTicks--; - if (soundTicks <= 0) { + if (soundTicks < 0) { soundTicks = PROJECTOR_SOUND_UPDATE_TICKS; if (!hasUpgrade(EnumForceFieldUpgrade.SILENCER)) { worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "warpdrive:projecting", 1.0F, 0.85F + 0.15F * worldObj.rand.nextFloat());