mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 01:57:34 +00:00
Music Switch Buffer
This commit is contained in:
1 parent
169e8784f1
commit
cd3175a963
1 file changed
+10
-4
@@ -13,6 +13,7 @@ public class MusicController {
|
||||
public PositionedSoundRecord playing;
|
||||
public ResourceLocation playingResource;
|
||||
public Entity playingEntity;
|
||||
public int musicChangeTick = 0;
|
||||
|
||||
public MusicController(){
|
||||
Instance = this;
|
||||
@@ -29,9 +30,11 @@ public class MusicController {
|
||||
}
|
||||
|
||||
public void playStreaming(String music, Entity entity){
|
||||
if(isPlaying(music)){
|
||||
return;
|
||||
if(isPlaying(music) || musicChangeTick < 100){
|
||||
musicChangeTick++;
|
||||
return;
|
||||
}
|
||||
musicChangeTick = 0;
|
||||
stopMusic();
|
||||
playingEntity = entity;
|
||||
playingResource = new ResourceLocation(music);
|
||||
@@ -41,8 +44,11 @@ public class MusicController {
|
||||
}
|
||||
|
||||
public void playMusic(String music, Entity entity) {
|
||||
if(isPlaying(music))
|
||||
return;
|
||||
if(isPlaying(music) || musicChangeTick < 100){
|
||||
musicChangeTick++;
|
||||
return;
|
||||
}
|
||||
musicChangeTick = 0;
|
||||
stopMusic();
|
||||
playingResource = new ResourceLocation(music);
|
||||
|
||||
|
||||
Reference in new issue
Block a user