Hbm-s-Nuclear-Tech-GIT/com/hbm/sound/MovingSoundPlayerLoop.java
HbmMods 5525318475 Merge branch 'master' of https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT
# Conflicts:
#	assets/hbm/lang/de_DE.lang
#	assets/hbm/lang/en_US.lang
#	assets/hbm/textures/armor/hazmat_paa_1.png
#	assets/hbm/textures/armor/paa_1.png
#	com/hbm/blocks/BlockCrate.java
#	com/hbm/blocks/ModBlocks.java
#	com/hbm/explosion/ExplosionNukeGeneric.java
#	com/hbm/handler/FuelHandler.java
#	com/hbm/items/GunMP.java
#	com/hbm/items/GunRevolver.java
#	com/hbm/items/ItemStarterKit.java
#	com/hbm/items/ModArmor.java
#	com/hbm/items/ModItems.java
#	com/hbm/lib/Library.java
#	com/hbm/lib/RefStrings.java
#	com/hbm/main/ClientProxy.java
#	com/hbm/main/CraftingManager.java
#	com/hbm/main/MainRegistry.java
#	com/hbm/main/ModEventHandlerClient.java
#	com/hbm/sound/MovingSoundPlayerLoop.java
#	com/hbm/sound/MovingSoundXVL1456.java
2016-10-30 20:38:35 +01:00

84 lines
2.1 KiB
Java

package com.hbm.sound;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public abstract class MovingSoundPlayerLoop extends MovingSound {
<<<<<<< HEAD
public static List<MovingSoundPlayerLoop> globalSoundList = new ArrayList<MovingSoundPlayerLoop>();
public List<Entity> playerForSound = new ArrayList<Entity>();
=======
public static List<MovingSoundPlayerLoop> globalSoundList = new ArrayList<MovingSoundPlayerLoop>();
>>>>>>> 540fb3d256a0f4ae6a8b1db586f8e9cfd6ed7372
public Entity player;
public enum EnumHbmSound { soundTauLoop, soundChopperLoop, soundCrashingLoop, soundMineLoop };
public EnumHbmSound type;
public boolean init;
public MovingSoundPlayerLoop(ResourceLocation res, Entity player, EnumHbmSound type) {
super(res);
this.player = player;
this.type = type;
this.init = false;
this.repeat = true;
if(MovingSoundPlayerLoop.getSoundByPlayer(player, type) == null)
globalSoundList.add(this);
}
@Override
public void update() {
if(player != null) {
this.xPosF = (float)player.posX;
this.yPosF = (float)player.posY;
this.zPosF = (float)player.posZ;
}
if(player == null || player.isDead)
this.stop();
}
public void stop() {
<<<<<<< HEAD
=======
>>>>>>> 540fb3d256a0f4ae6a8b1db586f8e9cfd6ed7372
this.donePlaying = true;
this.repeat = false;
while(MovingSoundPlayerLoop.getSoundByPlayer(player, type) != null)
globalSoundList.remove(MovingSoundPlayerLoop.getSoundByPlayer(player, type));
this.player = null;
}
public static MovingSoundPlayerLoop getSoundByPlayer(Entity player, EnumHbmSound type) {
for(MovingSoundPlayerLoop sound : globalSoundList) {
if(sound.player == player && sound.type == type)
return sound;
}
return null;
}
public void setPitch(float f) {
this.field_147663_c = f;
}
public void setVolume(float f) {
this.volume = f;
}
public void setDone(boolean b) {
this.donePlaying = b;
}
}