-Allows for the changing of several sound attributes, including volume, pitch, repeating, etc.

NpcAPI, IPlayer, IWorld:
-Added more sound functions, with sounds that can be stopped and started based on an ID.
This commit is contained in:
c0508383 committed 2022-07-13 19:27:27 -05:00
1 parent e6e266f3b6
commit d1762654ba
16 files changed
+566 -7

No files matched your search

+32 -1
View File
@@ -35,7 +35,6 @@ import net.minecraft.world.biome.BiomeGenBase;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.data.Faction;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.items.ItemScripted;
import noppes.npcs.containers.ContainerNpcInterface;
@@ -50,6 +49,7 @@ import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.data.IFaction;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.AbstractNpcAPI;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
@@ -334,6 +334,13 @@ public class NpcAPI extends AbstractNpcAPI {
return arr;
}
public String[] getPlayerNames() {
IPlayer[] players = getAllServerPlayers();
String[] names = new String[players.length];
for (int i = 0; i < names.length; ++i) names[i] = players[i].getDisplayName();
return names;
}
public void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch){
entity.getWorld().getMCWorld().playSoundAtEntity(entity.getMCEntity(), sound, volume, pitch);
}
@@ -361,6 +368,30 @@ public class NpcAPI extends AbstractNpcAPI {
return new ScriptParticle(directory);
}
public ISound createSound(String directory) {
return new ScriptSound(directory);
}
public void playSound(int id, ISound sound) {
NoppesUtilServer.playSound(id, (ScriptSound) sound);
}
public void stopSound(int id) {
NoppesUtilServer.stopSound(id);
}
public void pauseSounds() {
NoppesUtilServer.pauseSounds();
}
public void continueSounds() {
NoppesUtilServer.continueSounds();
}
public void stopSounds() {
NoppesUtilServer.stopSounds();
}
public int getServerTime() {
return MinecraftServer.getServer().getTickCounter();
}