mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 20:44:08 +00:00
Changed entity check for bards
This commit is contained in:
1 parent
2637d9de26
commit
2d9063cf24
2 files changed
+10
-2
No files matched your search
@@ -9,6 +9,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class MusicController {
|
||||
public static MusicController Instance;
|
||||
public ScriptClientSound sound;
|
||||
private Entity entity;
|
||||
|
||||
public MusicController(){
|
||||
Instance = this;
|
||||
@@ -33,6 +34,7 @@ public class MusicController {
|
||||
clientSound.setVolume(4.0F);
|
||||
clientSound.setAttenuationType(ISound.AttenuationType.LINEAR);
|
||||
this.sound = clientSound;
|
||||
this.entity = entity;
|
||||
|
||||
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
|
||||
soundHandler.playSound(clientSound);
|
||||
@@ -45,9 +47,11 @@ public class MusicController {
|
||||
|
||||
ScriptClientSound clientSound = new ScriptClientSound(music);
|
||||
clientSound.setEntity(entity);
|
||||
this.sound = clientSound;
|
||||
this.entity = entity;
|
||||
|
||||
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
|
||||
soundHandler.playSound(clientSound);
|
||||
this.sound = clientSound;
|
||||
}
|
||||
|
||||
public boolean isPlaying(String music) {
|
||||
@@ -66,6 +70,10 @@ public class MusicController {
|
||||
return this.sound != null;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
public void playSound(String music, float x, float y, float z) {
|
||||
Minecraft.getMinecraft().theWorld.playSound(x, y, z, music, 1, 1, false);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class JobBard extends JobInterface{
|
||||
if(!MusicController.Instance.isPlaying()){
|
||||
this.play();
|
||||
}
|
||||
else if(MusicController.Instance.sound.getEntity() != npc){
|
||||
else if(MusicController.Instance.getEntity() != npc){
|
||||
EntityPlayer player = CustomNpcs.proxy.getPlayer();
|
||||
if(npc.getDistanceToEntity(player) < MusicController.Instance.sound.getDistance()){
|
||||
MusicController.Instance.stopMusic();
|
||||
|
||||
Reference in new issue
Block a user