Permalink
Browse files

Fixed firearm sounds.

  • Loading branch information...
Ri5ux committed Sep 24, 2018
1 parent 2ba3755 commit 481fddded64e1005a3fb162c3a9005575aef3f0e
@@ -4,6 +4,7 @@
import java.util.List;
import org.avp.AliensVsPredator;
import org.avp.client.Sounds;
import org.avp.packets.server.PacketFirearmSync;
import org.avp.packets.server.PacketReloadFirearm;
@@ -21,6 +22,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceResult.Type;
@@ -98,7 +100,7 @@ public FirearmProfile(Classification classification)
this.reloadTime = 6 * 20;
this.ammoConsumptionRate = 1;
this.soundLength = 0;
this.sound = AliensVsPredator.sounds().fxWeaponPistol;
this.sound = Sounds.fxWeaponPistol;
this.register();
}
@@ -257,6 +259,13 @@ public void onUpdate(ItemStack itemstack, World world, Entity entity, int slot,
this.renderRecoil();
this.fixDelay();
if (this.profile != null && this.canSoundPlay())
{
world.playSound(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), this.profile.getSound().event(), SoundCategory.PLAYERS, 0.5F, 1F, true);
this.setLastSoundPlayed(System.currentTimeMillis());
}
if (trace != null && trace.typeOfHit == Type.BLOCK)
{
AliensVsPredator.network().sendToServer(new PacketFirearmSync(trace.typeOfHit, trace.entityHit, (int) trace.hitVec.x, (int) trace.hitVec.y, (int) trace.hitVec.z, this.profile));
@@ -17,6 +17,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -70,7 +71,6 @@ public void toBytes(ByteBuf buf)
@Override
public PacketFirearmSync onMessage(PacketFirearmSync packet, MessageContext ctx)
{
System.out.println("Sent packet " + this.getClass().getName());
ctx.getServerHandler().player.getServerWorld().addScheduledTask(new Runnable()
{
@Override

0 comments on commit 481fddd

Please sign in to comment.