-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

@@ -33,10 +33,12 @@ import noppes.npcs.controllers.data.*;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleFollower;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import noppes.npcs.scripted.ScriptSound;
import noppes.npcs.scripted.event.DialogEvent;
import noppes.npcs.scripted.event.QuestEvent;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.IQuestObjective;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
@@ -482,4 +484,27 @@ public class NoppesUtilPlayer {
return list;
}
public static void playSoundTo(EntityPlayerMP player, int id, ScriptSound sound) {
NBTTagCompound compound = sound.writeToNBT();
if (sound.sourceEntity == null || player.worldObj.provider.dimensionId == sound.sourceEntity.getDimension()) {
Server.sendData(player, EnumPacketClient.PLAY_SOUND_TO, id, compound);
}
}
public static void stopSoundFor(EntityPlayerMP player, int id) {
Server.sendData(player, EnumPacketClient.STOP_SOUND_FOR, id);
}
public static void pauseSoundsFor(EntityPlayerMP player) {
Server.sendData(player, EnumPacketClient.PAUSE_SOUNDS);
}
public static void continueSoundsFor(EntityPlayerMP player) {
Server.sendData(player, EnumPacketClient.CONTINUE_SOUNDS);
}
public static void stopSoundsFor(EntityPlayerMP player) {
Server.sendData(player, EnumPacketClient.STOP_SOUNDS);
}
}
@@ -71,6 +71,7 @@ import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleTransporter;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptSound;
import noppes.npcs.scripted.event.DialogEvent;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
@@ -324,6 +325,41 @@ public class NoppesUtilServer {
}
}
public static void playSound(int id, ScriptSound sound) {
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
NoppesUtilPlayer.playSoundTo((EntityPlayerMP) player, id, sound);
}
}
public static void stopSound(int id) {
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
NoppesUtilPlayer.stopSoundFor((EntityPlayerMP) player, id);
}
}
public static void pauseSounds() {
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
NoppesUtilPlayer.pauseSoundsFor((EntityPlayerMP) player);
}
}
public static void continueSounds() {
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
NoppesUtilPlayer.continueSoundsFor((EntityPlayerMP) player);
}
}
public static void stopSounds() {
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
NoppesUtilPlayer.stopSoundsFor((EntityPlayerMP) player);
}
}
public static void deleteNpc(EntityNPCInterface npc,EntityPlayer player) {
Server.sendAssociatedData(npc, EnumPacketClient.DELETE_NPC, npc.getEntityId());
}
@@ -131,6 +131,7 @@ import noppes.npcs.client.renderer.blocks.BlockWeaponRackRenderer;
import noppes.npcs.config.StringCache;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.*;
import noppes.npcs.client.controllers.ScriptSoundController;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.entity.*;
@@ -158,6 +159,7 @@ public class ClientProxy extends CommonProxy {
CustomNpcs.Channel.register(new PacketHandlerClient());
CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer());
new MusicController();
new ScriptSoundController();
RenderingRegistry.registerEntityRenderingHandler(EntityNpcPony.class, new RenderNPCPony());
RenderingRegistry.registerEntityRenderingHandler(EntityNpcCrystal.class, new RenderNpcCrystal(new ModelNpcCrystal(0.5F)));
@@ -6,6 +6,7 @@ import net.minecraft.world.World;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.client.controllers.MusicController;
import noppes.npcs.client.controllers.ScriptSoundController;
import noppes.npcs.client.gui.player.GuiQuestLog;
import noppes.npcs.client.renderer.RenderNPCInterface;
import noppes.npcs.constants.EnumPlayerPacket;
@@ -43,6 +44,7 @@ public class ClientTickHandler{
prevWorld = mc.theWorld;
MusicController.Instance.stopMusic();
}
ScriptSoundController.Instance.onUpdate();
}
@SubscribeEvent
@@ -25,6 +25,8 @@ import noppes.npcs.Server;
import noppes.npcs.ServerEventsHandler;
import noppes.npcs.client.ClientProxy.FontContainer;
import noppes.npcs.client.controllers.MusicController;
import noppes.npcs.client.controllers.ScriptClientSound;
import noppes.npcs.client.controllers.ScriptSoundController;
import noppes.npcs.client.gui.GuiNpcMobSpawnerAdd;
import noppes.npcs.client.gui.OverlayQuestTracking;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
@@ -305,5 +307,25 @@ public class PacketHandlerClient extends PacketHandlerServer{
}
} catch (Exception ignored) {}
}
else if(type == EnumPacketClient.PLAY_SOUND_TO) {
int id = buffer.readInt();
NBTTagCompound compound = Server.readNBT(buffer);
ScriptClientSound sound = ScriptClientSound.fromScriptSound(compound, player.worldObj);
ScriptSoundController.Instance.playSound(id,sound);
}
else if(type == EnumPacketClient.STOP_SOUND_FOR) {
int id = buffer.readInt();
ScriptSoundController.Instance.stopSound(id);
}
else if(type == EnumPacketClient.PAUSE_SOUNDS) {
ScriptSoundController.Instance.pauseAllSounds();
}
else if(type == EnumPacketClient.CONTINUE_SOUNDS) {
ScriptSoundController.Instance.continueAllSounds();
}
else if(type == EnumPacketClient.STOP_SOUNDS) {
ScriptSoundController.Instance.stopAllSounds();
}
}
}
@@ -0,0 +1,53 @@
package noppes.npcs.client.controllers;
import net.minecraft.client.audio.ITickableSound;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import noppes.npcs.scripted.ScriptSound;
public class ScriptClientSound extends MovingSound implements ITickableSound {
private Entity entity;
public boolean paused;
protected ScriptClientSound(ResourceLocation location) {
super(location);
}
public static ScriptClientSound fromScriptSound(NBTTagCompound compound, World world) {
ScriptSound sound = ScriptSound.fromNBT(compound);
ScriptClientSound clientSound = new ScriptClientSound(new ResourceLocation(sound.directory));
clientSound.xPosF = sound.xPosF;
clientSound.yPosF = sound.yPosF;
clientSound.zPosF = sound.zPosF;
clientSound.volume = sound.volume;
clientSound.field_147663_c = sound.pitch;
clientSound.repeat = sound.repeat;
clientSound.field_147665_h = sound.repeatDelay;
if (compound.hasKey("EntityID")) {
clientSound.entity = world.getEntityByID(compound.getInteger("EntityID"));
clientSound.field_147666_i = AttenuationType.NONE;
}
return clientSound;
}
public void stopSound() {
this.repeat = false;
this.volume = 0;
}
@Override
public void update() {
if (entity != null) {
if (this.entity.isDead) {
this.donePlaying = true;
} else {
this.xPosF = (float) (this.entity.posX);
this.yPosF = (float) (this.entity.posY);
this.zPosF = (float) (this.entity.posZ);
}
}
}
}
@@ -0,0 +1,68 @@
package noppes.npcs.client.controllers;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class ScriptSoundController {
public HashMap<Integer, ScriptClientSound> sounds = new HashMap<>();
public static ScriptSoundController Instance;
public ScriptSoundController() {
Instance = this;
}
public void onUpdate() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
final Set<Map.Entry<Integer, ScriptClientSound>> entrySet = sounds.entrySet();
for (Map.Entry<Integer, ScriptClientSound> entry : entrySet) {
ScriptClientSound sound = entry.getValue();
if (!soundHandler.isSoundPlaying(sound) && !sound.canRepeat() && !sound.paused) {
sounds.remove(entry.getKey());
}
}
}
public void playSound(int id, ScriptClientSound sound) {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
if (sounds.containsKey(id)) {
soundHandler.stopSound(sound);
sounds.get(id).stopSound();
}
sounds.put(id,sound);
soundHandler.playSound(sound);
}
public void stopSound(int id) {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
if (sounds.containsKey(id)) {
soundHandler.stopSound(sounds.get(id));
sounds.get(id).stopSound();
sounds.remove(id);
}
}
public void pauseAllSounds() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
soundHandler.pauseSounds();
for (ScriptClientSound sound : sounds.values()) {
sound.paused = true;
}
}
public void continueAllSounds() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
soundHandler.resumeSounds();
for (ScriptClientSound sound : sounds.values()) {
sound.paused = false;
}
}
public void stopAllSounds() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
soundHandler.stopSounds();
sounds.clear();
}
}
@@ -40,5 +40,10 @@ public enum EnumPacketClient {
UPDATE_ITEM,
PLAYER_UPDATE_SKIN_OVERLAYS,
OVERLAY_QUEST_TRACKING,
DISABLE_MOUSE_INPUT
DISABLE_MOUSE_INPUT,
PLAY_SOUND_TO,
STOP_SOUND_FOR,
PAUSE_SOUNDS,
CONTINUE_SOUNDS,
STOP_SOUNDS
}
+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();
}
@@ -0,0 +1,173 @@
package noppes.npcs.scripted;
import net.minecraft.nbt.*;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import java.lang.reflect.Field;
public class ScriptSound implements ISound {
public IEntity sourceEntity;
public String directory;
public float volume = 1.0F;
public float pitch = 1.0F;
public float xPosF;
public float yPosF;
public float zPosF;
public boolean repeat = false;
public int repeatDelay = 0;
public ScriptSound(String location) {
this.directory = location;
}
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
ScriptSound newSound = new ScriptSound("");
//Iterate through fields, check if they're not equal to a new object, write to NBT
for (Field field : ScriptSound.class.getDeclaredFields()) {
try {
if (field.getName().equals("sourceEntity") && this.sourceEntity != null) {
compound.setInteger("EntityID",this.sourceEntity.getEntityId());
} else if (!field.get(this).equals(field.get(newSound))) {
compound = writeNBTTag(compound, field.getType(), field.getName(), field.get(this));
}
} catch (Exception ignored) {}
}
return compound;
}
public NBTTagCompound writeNBTTag(NBTTagCompound compound, Class<?> c, String key, Object value) {
if (c == boolean.class) {
compound.setBoolean(key, (Boolean) value);
}
if (c == int.class) {
compound.setInteger(key, (Integer) value);
}
if (c == double.class) {
compound.setDouble(key, (Double) value);
}
if (c == float.class) {
compound.setFloat(key, (Float) value);
}
if (c == String.class) {
compound.setString(key, (String) value);
}
return compound;
}
private static Object readNBTTag(NBTTagCompound compound, String key) {
if (compound.getTag(key) instanceof NBTTagByte) {
return compound.getBoolean(key);
}
if (compound.getTag(key) instanceof NBTTagInt) {
return compound.getInteger(key);
}
if (compound.getTag(key) instanceof NBTTagDouble) {
return compound.getDouble(key);
}
if (compound.getTag(key) instanceof NBTTagFloat) {
return compound.getFloat(key);
}
if (compound.getTag(key) instanceof NBTTagString) {
return compound.getString(key);
}
return null;
}
public static ScriptSound fromNBT(NBTTagCompound compound) {
ScriptSound particle = new ScriptSound(compound.getString("directory"));
//Iterate through fields, check if compound has a key equal to the field's name, and if so set the field equal to that value from NBT.
for (Field field : ScriptSound.class.getDeclaredFields()) {
try {
if (compound.hasKey(field.getName())) {
if (!field.getName().equals("sourceEntity")) {
Object val = ScriptSound.readNBTTag(compound, field.getName());
if (val != null) {
field.set(particle, val);
}
}
}
} catch (Exception ignored) {}
}
return particle;
}
public void setEntity(IEntity entity) {
this.sourceEntity = entity;
}
public IEntity getEntity() {
return sourceEntity;
}
public void setRepeat(boolean repeat) {
this.repeat = repeat;
}
public boolean repeats() {
return this.repeat;
}
public void setRepeatDelay(int delay) {
this.repeatDelay = delay;
}
public int getRepeatDelay() {
return this.repeatDelay;
}
public void setVolume(float volume) {
this.volume = volume;
}
public float getVolume()
{
return this.volume;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
public float getPitch()
{
return this.pitch;
}
public void setPosition(IPos pos) {
this.xPosF = pos.getX();
this.yPosF = pos.getY();
this.zPosF = pos.getZ();
}
public void setPosition(float x, float y, float z) {
this.xPosF = x;
this.yPosF = y;
this.zPosF = z;
}
public IPos getPos() {
return new ScriptBlockPos(new BlockPos(xPosF,yPosF,zPosF));
}
public float getX() {
return this.xPosF;
}
public float getY() {
return this.yPosF;
}
public float getZ() {
return this.zPosF;
}
}
@@ -31,6 +31,7 @@ import noppes.npcs.scripted.interfaces.IParticle;
import noppes.npcs.scripted.interfaces.ITileEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.IWorld;
@@ -152,6 +153,51 @@ public class ScriptWorld implements IWorld {
world.playSoundToNearExcept((EntityPlayerMP) player.getMCEntity(), sound, volume, pitch);
}
public void playSound(int id, ISound sound) {
IPlayer[] players = getAllServerPlayers();
for (IPlayer player : players) {
if (player.getDimension() == this.getDimensionID()) {
player.playSound(id, sound);
}
}
}
public void stopSound(int id) {
IPlayer[] players = getAllServerPlayers();
for (IPlayer player : players) {
if (player.getDimension() == this.getDimensionID()) {
player.stopSound(id);
}
}
}
public void pauseSounds() {
IPlayer[] players = getAllServerPlayers();
for (IPlayer player : players) {
if (player.getDimension() == this.getDimensionID()) {
player.pauseSounds();
}
}
}
public void continueSounds() {
IPlayer[] players = getAllServerPlayers();
for (IPlayer player : players) {
if (player.getDimension() == this.getDimensionID()) {
player.continueSounds();
}
}
}
public void stopSounds() {
IPlayer[] players = getAllServerPlayers();
for (IPlayer player : players) {
if (player.getDimension() == this.getDimensionID()) {
player.stopSounds();
}
}
}
public IEntity getEntityByID(int id){
return NpcAPI.Instance().getIEntity(world.getEntityByID(id));
}
@@ -654,7 +700,8 @@ public class ScriptWorld implements IWorld {
public void explode(double x, double y, double z, float range, boolean fire, boolean grief){
world.newExplosion(null, x, y, z, range, fire, grief);
}
@Deprecated
public IPlayer[] getAllServerPlayers(){
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
IPlayer[] arr = new IPlayer[list.size()];
@@ -665,6 +712,7 @@ public class ScriptWorld implements IWorld {
return arr;
}
@Deprecated
public String[] getPlayerNames() {
IPlayer[] players = getAllServerPlayers();
String[] names = new String[players.length];
@@ -14,8 +14,6 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Vec3;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldSettings;
import noppes.npcs.*;
import noppes.npcs.constants.EnumPacketClient;
@@ -34,14 +32,14 @@ import noppes.npcs.controllers.QuestController;
import noppes.npcs.controllers.data.QuestData;
import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptBlockPos;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
import noppes.npcs.scripted.ScriptSound;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.handler.IPlayerData;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.entity.IEntity;
@@ -479,6 +477,26 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
player.playSound(name, volume, pitch);
}
public void playSound(int id, ISound sound) {
NoppesUtilPlayer.playSoundTo(player, id, (ScriptSound) sound);
}
public void stopSound(int id) {
NoppesUtilPlayer.stopSoundFor(player, id);
}
public void pauseSounds() {
NoppesUtilPlayer.pauseSoundsFor(player);
}
public void continueSounds() {
NoppesUtilPlayer.continueSoundsFor(player);
}
public void stopSounds() {
NoppesUtilPlayer.stopSoundsFor(player);
}
public void mountEntity(Entity ridingEntity){
player.mountEntity(ridingEntity);
}
@@ -22,13 +22,16 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.controllers.*;
import noppes.npcs.scripted.ScriptSound;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.*;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.overlay.ScriptOverlay;
@@ -153,6 +156,8 @@ public abstract class AbstractNpcAPI {
public abstract IPlayer[] getAllServerPlayers();
public abstract String[] getPlayerNames();
public abstract IItemStack createItem(String id, int damage, int size);
public abstract void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
@@ -179,6 +184,18 @@ public abstract class AbstractNpcAPI {
@Deprecated
public abstract IParticle createEntityParticle(String directory);
public abstract ISound createSound(String directory);
public abstract void playSound(int id, ISound sound);
public abstract void stopSound(int id);
public abstract void pauseSounds();
public abstract void continueSounds();
public abstract void stopSounds();
/**
*
* @return The uptime of the server in MC ticks.
@@ -8,6 +8,7 @@ import noppes.npcs.scripted.ScriptBlockPos;
import noppes.npcs.scripted.ScriptScoreboard;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IWorld {
@@ -82,6 +83,16 @@ public interface IWorld {
void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
void playSound(int id, ISound sound);
void stopSound(int id);
void pauseSounds();
void continueSounds();
void stopSounds();
IEntity getEntityByID(int id);
boolean spawnEntityInWorld(IEntity entity);
@@ -9,6 +9,7 @@ import noppes.npcs.scripted.interfaces.handler.IPlayerData;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.data.ISound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
@@ -188,6 +189,16 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
void playSound(String name, float volume, float pitch);
void playSound(int id, ISound sound);
void stopSound(int id);
void pauseSounds();
void continueSounds();
void stopSounds();
void mountEntity(Entity ridingEntity);
IEntity dropOneItem(boolean dropStack);
@@ -0,0 +1,37 @@
package noppes.npcs.scripted.interfaces.handler.data;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.interfaces.entity.IEntity;
public interface ISound {
void setEntity(IEntity entity);
IEntity getEntity();
void setRepeat(boolean repeat);
boolean repeats();
void setRepeatDelay(int delay);
int getRepeatDelay();
void setVolume(float volume);
float getVolume();
void setPitch(float pitch);
float getPitch();
void setPosition(IPos pos);
void setPosition(float x, float y, float z);
float getX();
float getY();
float getZ();
}