Skip to content

Commit

Permalink
Merge pull request #5 from aw11man/silencerfix
Browse files Browse the repository at this point in the history
  • Loading branch information
JT2AW15 committed Dec 13, 2021
2 parents d6f15f3 + d9e01ec commit cd385c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/flansmod/common/guns/ItemGun.java
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ public void playShotSound(World world, Vector3f position, Boolean silenced) {
// Play shot sounds
if(soundDelay <= 0 && type.shootSound != null)
{
PacketPlaySound.sendSoundPacket(position.x, position.y, position.z, FlansMod.soundRange, world.provider.getDimension(), type.shootSound, silenced);
PacketPlaySound.sendSoundPacket(position.x, position.y, position.z, silenced ? (FlansMod.soundRange*0.75F) : FlansMod.soundRange, world.provider.getDimension(), type.shootSound, silenced);
soundDelay = type.idleSoundLength;
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/flansmod/common/network/PacketPlaySound.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,34 @@ public PacketPlaySound()
{
}

public static void sendSoundPacket(double x, double y, double z, double range, int dimension, String s, boolean distort)
public static void sendSoundPacket(double x, double y, double z, double range, int dimension, String s, boolean silenced)
{
sendSoundPacket(x, y, z, range, dimension, s, distort, false);
sendSoundPacket(x, y, z, range, dimension, s, silenced, false);
}

public static void sendSoundPacket(double x, double y, double z, double range, int dimension, String s, boolean distort, boolean silenced)
public static void sendSoundPacket(double x, double y, double z, double range, int dimension, String s, boolean silenced, boolean distort)
{
FlansMod.getPacketHandler().sendToAllAround(new PacketPlaySound(x, y, z, s, distort, silenced), x, y, z, (float)range, dimension);
FlansMod.getPacketHandler().sendToAllAround(new PacketPlaySound(x, y, z, s, silenced, distort), x, y, z, (float)range, dimension);
}

public PacketPlaySound(double x, double y, double z, String s)
{
this(x, y, z, s, false);
}

public PacketPlaySound(double x, double y, double z, String s, boolean distort)
public PacketPlaySound(double x, double y, double z, String s, boolean silenced)
{
this(x, y, z, s, distort, false);
this(x, y, z, s, silenced, false);
}

public PacketPlaySound(double x, double y, double z, String s, boolean distort, boolean silenced)
public PacketPlaySound(double x, double y, double z, String s, boolean silenced, boolean distort)
{
posX = (float)x;
posY = (float)y;
posZ = (float)z;
sound = s;
this.distort = distort;
this.silenced = silenced;
this.distort = distort;

Matrix2f audioMatrix = Matrix2f.generateAudioMatrix(x, y, z);
hash = audioMatrix.coords.hash;
Expand Down

0 comments on commit cd385c7

Please sign in to comment.