├── README.md └── noppes └── npcs └── api ├── CustomNPCsException.java ├── IContainer.java ├── IDamageSource.java ├── IDimension.java ├── INbt.java ├── IPos.java ├── IRayTrace.java ├── IScoreboard.java ├── IScoreboardObjective.java ├── IScoreboardScore.java ├── IScoreboardTeam.java ├── ITimers.java ├── IWorld.java ├── NpcAPI.java ├── block ├── IBlock.java ├── IBlockFluidContainer.java ├── IBlockScripted.java ├── IBlockScriptedDoor.java └── ITextPlane.java ├── constants ├── AnimationType.java ├── EntitiesType.java ├── GuiComponentType.java ├── ItemType.java ├── JobType.java ├── MarkType.java ├── MenuNames.java ├── OptionType.java ├── PotionEffectType.java ├── QuestType.java ├── RoleType.java └── SideType.java ├── entity ├── IAnimal.java ├── IArrow.java ├── ICustomNpc.java ├── IEntity.java ├── IEntityItem.java ├── IEntityLiving.java ├── IMob.java ├── IMonster.java ├── IPixelmon.java ├── IPlayer.java ├── IProjectile.java ├── IThrowable.java ├── IVillager.java └── data │ ├── IData.java │ ├── ILine.java │ ├── IMark.java │ ├── INPCAdvanced.java │ ├── INPCAi.java │ ├── INPCDisplay.java │ ├── INPCInventory.java │ ├── INPCJob.java │ ├── INPCMelee.java │ ├── INPCRanged.java │ ├── INPCRole.java │ ├── INPCStats.java │ ├── IPixelmonPlayerData.java │ ├── IPlayerMail.java │ └── role │ ├── IJobBard.java │ ├── IJobBuilder.java │ ├── IJobFarmer.java │ ├── IJobFollower.java │ ├── IJobPuppet.java │ ├── IJobSpawner.java │ ├── IRoleDialog.java │ ├── IRoleFollower.java │ ├── IRoleTrader.java │ └── IRoleTransporter.java ├── event ├── BlockEvent.java ├── CustomGuiEvent.java ├── CustomNPCsEvent.java ├── DialogEvent.java ├── ForgeEvent.java ├── HandlerEvent.java ├── ItemEvent.java ├── NpcEvent.java ├── PlayerEvent.java ├── ProjectileEvent.java ├── QuestEvent.java ├── RoleEvent.java └── WorldEvent.java ├── function ├── EventWrapper.java └── gui │ ├── GuiAction.java │ ├── GuiCallback.java │ ├── GuiClosed.java │ ├── GuiComponentAction.java │ ├── GuiComponentHold.java │ ├── GuiComponentState.java │ ├── GuiItemSlotAccepts.java │ ├── GuiItemSlotClicked.java │ ├── GuiItemSlotUpdate.java │ └── GuiScrollAction.java ├── gui ├── IAssetsSelector.java ├── IButton.java ├── IButtonList.java ├── IComponentsScrollableWrapper.java ├── IComponentsWrapper.java ├── ICustomGui.java ├── ICustomGuiComponent.java ├── IEntityDisplay.java ├── IItemSlot.java ├── ILabel.java ├── IScroll.java ├── ISlider.java ├── ITextArea.java ├── ITextField.java ├── ITexturedButton.java ├── ITexturedRect.java └── ScrollItem.java ├── handler ├── ICloneHandler.java ├── IDialogHandler.java ├── IFactionHandler.java ├── IQuestHandler.java ├── IRecipeHandler.java └── data │ ├── IAvailability.java │ ├── IDialog.java │ ├── IDialogCategory.java │ ├── IDialogOption.java │ ├── IFaction.java │ ├── IQuest.java │ ├── IQuestCategory.java │ ├── IQuestObjective.java │ └── IRecipe.java └── item ├── IItemArmor.java ├── IItemBlock.java ├── IItemBook.java ├── IItemScripted.java └── IItemStack.java /README.md: -------------------------------------------------------------------------------- 1 | # CustomNPCsAPI 2 | Work in progress, is used by scripting and mods who want to hook into CustomNPCs 1.8.9 or higher 3 | 4 | ## Howto use in a Mod 5 | Basically just download the api code and include it in your mod. 6 | 7 | In your mod you can check if customnpcs is installed with `NpcAPI.IsAvailable()` 8 | 9 | To use the events, register your events with `NpcAPI.Instance().events().register(youreventclass)` 10 | 11 | ## Extra 12 | JavaDocs go to http://www.kodevelopment.nl/customnpcs/api/ 13 | Discord for CustomNpcs Scripting/API go to https://discord.gg/2jZm88M 14 | Discord for my mods in general go to https://discord.gg/0qZ6X3cHl8Pupttr -------------------------------------------------------------------------------- /noppes/npcs/api/CustomNPCsException.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public class CustomNPCsException extends RuntimeException { 4 | 5 | public CustomNPCsException(String message, Object... obs){ 6 | super(String.format(message, obs)); 7 | } 8 | 9 | public CustomNPCsException(Exception ex, String message, Object... obs){ 10 | super(String.format(message, obs), ex); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/IContainer.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.world.Container; 4 | import net.minecraft.world.inventory.AbstractContainerMenu; 5 | import noppes.npcs.api.item.IItemStack; 6 | 7 | public interface IContainer { 8 | 9 | public int getSize(); 10 | 11 | public IItemStack getSlot(int slot); 12 | 13 | public void setSlot(int slot, IItemStack item); 14 | 15 | /** 16 | * Expert users only 17 | * @return Returns minecrafts container 18 | */ 19 | public Container getMCInventory(); 20 | 21 | /** 22 | * Expert users only 23 | * @return Returns minecrafts container 24 | */ 25 | public AbstractContainerMenu getMCContainer(); 26 | 27 | /** 28 | * @param item 29 | * @param ignoreDamage Whether to ignore the item_damage value when comparing 30 | * @param ignoreNBT Whether to ignore NBT when comparing 31 | * @return 32 | */ 33 | public int count(IItemStack item, boolean ignoreDamage, boolean ignoreNBT); 34 | 35 | public IItemStack[] getItems(); 36 | } 37 | -------------------------------------------------------------------------------- /noppes/npcs/api/IDamageSource.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.world.damagesource.DamageSource; 4 | import noppes.npcs.api.entity.IEntity; 5 | 6 | public interface IDamageSource { 7 | 8 | public String getType(); 9 | 10 | public boolean isUnblockable(); 11 | 12 | public boolean isProjectile(); 13 | 14 | public IEntity getTrueSource(); 15 | 16 | public IEntity getImmediateSource(); 17 | 18 | public DamageSource getMCDamageSource(); 19 | } 20 | -------------------------------------------------------------------------------- /noppes/npcs/api/IDimension.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface IDimension { 4 | 5 | public String getId(); 6 | } 7 | -------------------------------------------------------------------------------- /noppes/npcs/api/INbt.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.nbt.Tag; 5 | 6 | 7 | 8 | /** 9 | * @author Karel 10 | * 11 | */ 12 | public interface INbt { 13 | 14 | public void remove(String key); 15 | 16 | public boolean has(String key); 17 | 18 | public boolean getBoolean(String key); 19 | 20 | public void setBoolean(String key, boolean value); 21 | 22 | public short getShort(String key); 23 | 24 | public void setShort(String key, short value); 25 | 26 | public int getInteger(String key); 27 | 28 | public void setInteger(String key, int value); 29 | 30 | public byte getByte(String key); 31 | 32 | public void setByte(String key, byte value); 33 | 34 | public long getLong(String key); 35 | 36 | public void setLong(String key, long value); 37 | 38 | public double getDouble(String key); 39 | 40 | public void setDouble(String key, double value); 41 | 42 | public float getFloat(String key); 43 | 44 | public void setFloat(String key, float value); 45 | 46 | public String getString(String key); 47 | 48 | public void putString(String key, String value); 49 | 50 | public byte[] getByteArray(String key); 51 | 52 | public void setByteArray(String key, byte[] value); 53 | 54 | public int[] getIntegerArray(String key); 55 | 56 | public void setIntegerArray(String key, int[] value); 57 | 58 | /** 59 | * @param key 60 | * @param type The Type of the list 3:Integer, 5:Float, 6:Double, 8:String, 61 | * 10:INbt, 11:Integer[] 62 | * @return 63 | */ 64 | public Object[] getList(String key, int type); 65 | 66 | /** 67 | * @param key 68 | * @return 3:Integer, 5:Float, 6:Double, 8:String, 10:INbt, 11:Integer[] 69 | */ 70 | public int getListType(String key); 71 | 72 | public void setList(String key, Object[] value); 73 | 74 | public INbt getCompound(String key); 75 | 76 | public void setCompound(String key, INbt value); 77 | 78 | public String[] getKeys(); 79 | 80 | /** 81 | * @param key 82 | * @return 1:Byte, 2:Short 3:Integer, 4:Long, 5:Float, 6:Double, 7:Byte[], 83 | * 8:String, 9:List, 10:INbt, 11:Integer[] 84 | */ 85 | public int getType(String key); 86 | 87 | public CompoundTag getMCNBT(); 88 | 89 | public String toJsonString(); 90 | 91 | /** 92 | * Compares if two nbt tags are the same/contain the same data 93 | */ 94 | public boolean isEqual(INbt nbt); 95 | 96 | /** 97 | * Clears all tags 98 | */ 99 | public void clear(); 100 | 101 | public boolean isEmpty(); 102 | 103 | /** 104 | * Merges two nbt tabs, note that nbt tags will be overwritten if they have the 105 | * same keys 106 | */ 107 | public void merge(INbt nbt); 108 | 109 | public void mcSetTag(String key, Tag base); 110 | 111 | public Tag mcGetTag(String key); 112 | } 113 | -------------------------------------------------------------------------------- /noppes/npcs/api/IPos.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.core.BlockPos; 4 | 5 | 6 | 7 | /** 8 | * All the methods in IPos create a new IPos object 9 | */ 10 | public interface IPos { 11 | 12 | public int getX(); 13 | 14 | public int getY(); 15 | 16 | public int getZ(); 17 | 18 | public IPos up(); 19 | 20 | public IPos up(int n); 21 | 22 | public IPos down(); 23 | 24 | public IPos down(int n); 25 | 26 | public IPos north(); 27 | 28 | public IPos north(int n); 29 | 30 | public IPos east(); 31 | 32 | public IPos east(int n); 33 | 34 | public IPos south(); 35 | 36 | public IPos south(int n); 37 | 38 | public IPos west(); 39 | 40 | public IPos west(int n); 41 | 42 | public IPos add(int x, int y, int z); 43 | 44 | public IPos add(IPos pos); 45 | 46 | public IPos subtract(int x, int y, int z); 47 | 48 | public IPos subtract(IPos pos); 49 | 50 | public double[] normalize(); 51 | 52 | public BlockPos getMCBlockPos(); 53 | 54 | /** 55 | * @param direction {@link noppes.npcs.api.constants.SideType} 56 | */ 57 | public IPos offset(int direction); 58 | 59 | /** 60 | * @param direction {@link noppes.npcs.api.constants.SideType} 61 | * @param n how many positions 62 | */ 63 | public IPos offset(int direction, int n); 64 | 65 | public double distanceTo(IPos pos); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /noppes/npcs/api/IRayTrace.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import noppes.npcs.api.block.IBlock; 4 | 5 | public interface IRayTrace { 6 | public IPos getPos(); 7 | 8 | public IBlock getBlock(); 9 | 10 | public int getSideHit(); 11 | } 12 | -------------------------------------------------------------------------------- /noppes/npcs/api/IScoreboard.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface IScoreboard { 4 | 5 | public IScoreboardObjective[] getObjectives(); 6 | 7 | 8 | /** 9 | * @return Returns null if the objective is not found 10 | */ 11 | public IScoreboardObjective getObjective(String name); 12 | 13 | 14 | public boolean hasObjective(String objective); 15 | 16 | 17 | public void removeObjective(String objective); 18 | 19 | 20 | /** 21 | * @param objective Scoreboard objective name (1-16 chars) 22 | * @param criteria The criteria see http://minecraft.gamepedia.com/Scoreboard#Objectives 23 | * @return Returns the created ScoreboardObjective 24 | */ 25 | public IScoreboardObjective addObjective(String objective, String criteria); 26 | 27 | public void setPlayerScore(String player, String objective, int score); 28 | 29 | public int getPlayerScore(String player, String objective); 30 | 31 | public boolean hasPlayerObjective(String player, String objective); 32 | 33 | public void deletePlayerScore(String player, String objective); 34 | 35 | 36 | public IScoreboardTeam[] getTeams(); 37 | 38 | 39 | public boolean hasTeam(String name); 40 | 41 | 42 | public IScoreboardTeam addTeam(String name); 43 | 44 | 45 | public IScoreboardTeam getTeam(String name); 46 | 47 | 48 | public void removeTeam(String name); 49 | 50 | /** 51 | * @param player the player whos team you want to get 52 | * @return The players team 53 | */ 54 | public IScoreboardTeam getPlayerTeam(String player); 55 | 56 | /** 57 | * @param player The players who should be removed from his team 58 | */ 59 | public void removePlayerTeam(String player); 60 | 61 | 62 | public String[] getPlayerList(); 63 | } 64 | -------------------------------------------------------------------------------- /noppes/npcs/api/IScoreboardObjective.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface IScoreboardObjective { 4 | 5 | public String getName(); 6 | 7 | public String getDisplayName(); 8 | 9 | /** 10 | * @param name Name used for display (1-32 chars) 11 | */ 12 | public void setDisplayName(String name); 13 | 14 | public String getCriteria(); 15 | 16 | /** 17 | * @return Return whether or not the objective value can be changed. E.g. player health can't be changed 18 | */ 19 | public boolean isReadyOnly(); 20 | 21 | public IScoreboardScore[] getScores(); 22 | 23 | public IScoreboardScore getScore(String player); 24 | 25 | public boolean hasScore(String player); 26 | 27 | public IScoreboardScore createScore(String player); 28 | 29 | public void removeScore(String player); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /noppes/npcs/api/IScoreboardScore.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface IScoreboardScore { 4 | 5 | public int getValue(); 6 | 7 | public void setValue(int val); 8 | 9 | public String getPlayerName(); 10 | } 11 | -------------------------------------------------------------------------------- /noppes/npcs/api/IScoreboardTeam.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface IScoreboardTeam { 4 | 5 | public String getName(); 6 | 7 | public String getDisplayName(); 8 | 9 | /** 10 | * @param name Name used as display (1-32 chars) 11 | */ 12 | public void setDisplayName(String name); 13 | 14 | public void addPlayer(String player); 15 | 16 | public boolean hasPlayer(String player); 17 | 18 | public void removePlayer(String player); 19 | 20 | public String[] getPlayers(); 21 | 22 | public void clearPlayers(); 23 | 24 | public boolean getFriendlyFire(); 25 | 26 | public void setFriendlyFire(boolean bo); 27 | 28 | /** 29 | * @param color Valid color values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", and "white". Or "reset" if you want default 30 | */ 31 | public void setColor(String color); 32 | 33 | /** 34 | * @return Returns color string. Returns null if no color was set 35 | */ 36 | public String getColor(); 37 | 38 | public void setSeeInvisibleTeamPlayers(boolean bo); 39 | 40 | public boolean getSeeInvisibleTeamPlayers(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /noppes/npcs/api/ITimers.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | public interface ITimers { 4 | 5 | 6 | /** 7 | * Used for timer events, will throw an error if a timer with the id is already started 8 | * @param id The timers id 9 | * @param ticks After how many ticks the timer triggers 10 | * @param repeat Whether it resets the timer when done or deletes it 11 | */ 12 | public void start(int id, int ticks, boolean repeat); 13 | 14 | /** 15 | * Used for timer events, wont throw an error if an timer with this id already exists and will overwrite it with this new one 16 | * @param id The timers id 17 | * @param ticks After how many ticks the timer triggers 18 | * @param repeat Whether it resets the timer when done or deletes it 19 | */ 20 | public void forceStart(int id, int ticks, boolean repeat); 21 | 22 | /** 23 | * @return Returns true if a timer with this id is already active 24 | */ 25 | public boolean has(int id); 26 | 27 | /** 28 | * @return Returns false if there was no timer with the giver id 29 | */ 30 | public boolean stop(int id); 31 | 32 | /** 33 | * Resets the timer back to 0 34 | */ 35 | public void reset(int id); 36 | 37 | public void clear(); 38 | } 39 | -------------------------------------------------------------------------------- /noppes/npcs/api/IWorld.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.server.level.ServerLevel; 5 | import noppes.npcs.api.block.IBlock; 6 | import noppes.npcs.api.constants.EntitiesType; 7 | import noppes.npcs.api.entity.IEntity; 8 | import noppes.npcs.api.entity.IPlayer; 9 | import noppes.npcs.api.entity.data.IData; 10 | import noppes.npcs.api.item.IItemStack; 11 | 12 | public interface IWorld { 13 | 14 | /** 15 | * @deprecated 16 | */ 17 | IEntity[] getNearbyEntities(int x, int y, int z, int range, int type); 18 | 19 | IEntity[] getNearbyEntities(IPos pos, int range, int type); 20 | 21 | /** 22 | * @deprecated 23 | */ 24 | IEntity getClosestEntity(int x, int y, int z, int range, int type); 25 | 26 | IEntity getClosestEntity(IPos pos, int range, int type); 27 | 28 | /** 29 | * This gets all currently loaded entities in a world 30 | * @param type {@link EntitiesType}} 31 | * @return An array of all entities 32 | */ 33 | IEntity[] getAllEntities(int type); 34 | 35 | /** 36 | * @return The world time 37 | */ 38 | long getTime(); 39 | 40 | void setTime(long time); 41 | 42 | /** 43 | * @return The total world time (doesn't change with the /time set command 44 | */ 45 | long getTotalTime(); 46 | 47 | /** 48 | * @deprecated 49 | */ 50 | IBlock getBlock(int x, int y, int z); 51 | 52 | /** 53 | * @return The block at the given position. Returns null if there isn't a block 54 | */ 55 | IBlock getBlock(IPos pos); 56 | 57 | /** 58 | * @deprecated metadata nolonger exists 59 | */ 60 | void setBlock(int x, int y, int z, String name, int meta); 61 | IBlock setBlock(IPos pos, String name); 62 | /** 63 | * @deprecated 64 | */ 65 | void removeBlock(int x, int y, int z); 66 | void removeBlock(IPos pos); 67 | 68 | /** 69 | * @return Returns a value between 0 and 1 70 | */ 71 | float getLightValue(int x, int y, int z); 72 | 73 | /** 74 | * @param name The name of the player to be returned 75 | * @return The Player with name. Null is returned when the player isnt found 76 | */ 77 | IPlayer getPlayer(String name); 78 | 79 | boolean isDay(); 80 | 81 | boolean isRaining(); 82 | 83 | IDimension getDimension(); 84 | 85 | void setRaining(boolean bo); 86 | 87 | void thunderStrike(double x, double y, double z); 88 | 89 | /** 90 | * Sound will be played in a 16 block range 91 | * @param pos Pos at which to play 92 | * @param sound Sound resource name 93 | * @param volume default 1 94 | * @param pitch default 1 95 | */ 96 | void playSoundAt(IPos pos, String sound, float volume, float pitch); 97 | 98 | /** 99 | * Sends a packet from the server to the client everytime its called. Probably should not use this too much. 100 | * @param particle Particle name. Particle name list: http://minecraft.gamepedia.com/Particles 101 | * @param x The x position 102 | * @param y The y position 103 | * @param z The z position 104 | * @param dx Usually used for the x motion 105 | * @param dy Usually used for the y motion 106 | * @param dz Usually used for the z motion 107 | * @param speed Speed of the particles, usually between 0 and 1 108 | * @param count Particle count 109 | */ 110 | void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count); 111 | 112 | /** 113 | * Sends a packet from the server to the client everytime its called. Probably should not use this too much. 114 | * @param name Block name. 115 | * @param x The x position 116 | * @param y The y position 117 | * @param z The z position 118 | * @param dx Usually used for the x motion 119 | * @param dy Usually used for the y motion 120 | * @param dz Usually used for the z motion 121 | * @param speed Speed of the particles, usually between 0 and 1 122 | * @param count Particle count 123 | */ 124 | void spawnParticleBlock(String name, double x, double y, double z, double dx, double dy, double dz, double speed, int count); 125 | 126 | void broadcast(String message); 127 | 128 | IScoreboard getScoreboard(); 129 | 130 | /** 131 | * Stores any type of data, but will be gone on restart 132 | * Temp data is the same cross dimension 133 | */ 134 | IData getTempdata(); 135 | 136 | /** 137 | * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved. 138 | * Stored data is the same cross dimension 139 | */ 140 | IData getStoreddata(); 141 | 142 | IItemStack createItem(String name, int size); 143 | 144 | IItemStack createItemFromNbt(INbt nbt); 145 | 146 | 147 | /** 148 | * @param x Position x 149 | * @param y Position y 150 | * @param z Position z 151 | * @param range Range of the explosion 152 | * @param fire Whether or not the explosion does fire damage 153 | * @param grief Whether or not the explosion does damage to blocks 154 | */ 155 | void explode(double x, double y, double z, float range, boolean fire, boolean grief); 156 | 157 | IPlayer[] getAllPlayers(); 158 | 159 | String getBiomeName(int x, int z); 160 | 161 | void spawnEntity(IEntity entity); 162 | 163 | /** 164 | * Depricated, use the API.clones.spawn instead 165 | */ 166 | @Deprecated 167 | IEntity spawnClone(double x, double y, double z, int tab, String name); 168 | 169 | /** 170 | * Depricated, use the API.clones.get instead 171 | */ 172 | @Deprecated 173 | IEntity getClone(int tab, String name); 174 | 175 | /** 176 | * @return value between 0 and 16 177 | */ 178 | int getRedstonePower(int x, int y, int z); 179 | 180 | /** 181 | * Expert users only 182 | * @return Returns minecrafts world 183 | */ 184 | ServerLevel getMCLevel(); 185 | 186 | /** 187 | * Expert users only 188 | * @return Returns minecraft BlockPos object 189 | */ 190 | BlockPos getMCBlockPos(int x, int y, int z); 191 | 192 | /** 193 | * @param uuid entity uuid 194 | * @return Returns entity based on uuid 195 | */ 196 | IEntity getEntity(String uuid); 197 | 198 | IEntity createEntityFromNBT(INbt nbt); 199 | 200 | IEntity createEntity(String id); 201 | 202 | IBlock getSpawnPoint(); 203 | 204 | void setSpawnPoint(IBlock block); 205 | 206 | String getName(); 207 | 208 | /** 209 | * Fires trigger event for forge scripts 210 | * @param id, Id for the event 211 | * @param arguments, arguments you can give with it 212 | */ 213 | void trigger(int id, Object... arguments); 214 | 215 | /** 216 | * Syncs any changed block data to the client 217 | */ 218 | void triggerBlockUpdate(IPos pos); 219 | } 220 | -------------------------------------------------------------------------------- /noppes/npcs/api/NpcAPI.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.server.level.ServerLevel; 6 | import net.minecraft.world.Container; 7 | import net.minecraft.world.damagesource.DamageSource; 8 | import net.minecraft.world.entity.Entity; 9 | import net.minecraft.world.inventory.AbstractContainerMenu; 10 | import net.minecraft.world.item.ItemStack; 11 | import net.minecraft.world.level.Level; 12 | import net.minecraft.world.level.dimension.DimensionType; 13 | import net.minecraftforge.eventbus.api.IEventBus; 14 | import net.minecraftforge.fml.ModList; 15 | import noppes.npcs.api.block.IBlock; 16 | import noppes.npcs.api.entity.ICustomNpc; 17 | import noppes.npcs.api.entity.IEntity; 18 | import noppes.npcs.api.entity.IPlayer; 19 | import noppes.npcs.api.entity.data.IPlayerMail; 20 | import noppes.npcs.api.gui.ICustomGui; 21 | import noppes.npcs.api.handler.*; 22 | import noppes.npcs.api.item.IItemStack; 23 | 24 | import java.io.File; 25 | 26 | /** 27 | * Note this API should only be used Server side not on the client 28 | * 29 | */ 30 | public abstract class NpcAPI { 31 | private static NpcAPI instance = null; 32 | 33 | /** 34 | * Doesnt spawn the npc in the world 35 | */ 36 | public abstract ICustomNpc createNPC(Level world); 37 | 38 | /** 39 | * Creates and spawns an npc 40 | */ 41 | public abstract ICustomNpc spawnNPC(Level level, int x, int y, int z); 42 | 43 | 44 | public abstract IEntity getIEntity(Entity entity); 45 | 46 | public abstract IBlock getIBlock(Level level, BlockPos pos); 47 | 48 | public abstract IContainer getIContainer(Container container); 49 | 50 | public abstract IContainer getIContainer(AbstractContainerMenu container); 51 | 52 | public abstract IItemStack getIItemStack(ItemStack itemstack); 53 | 54 | public abstract IWorld getIWorld(ServerLevel world); 55 | 56 | /** 57 | * @param dimension 'minecraft:overworld', 'minecraft:the_nether', 'minecraft:the_end' 58 | */ 59 | public abstract IWorld getIWorld(String dimension); 60 | 61 | public abstract IWorld getIWorld(DimensionType dimension); 62 | 63 | public abstract IWorld[] getIWorlds(); 64 | 65 | public abstract INbt getINbt(CompoundTag compound); 66 | 67 | public abstract IPos getIPos(double x, double y, double z); 68 | 69 | public abstract IFactionHandler getFactions(); 70 | 71 | public abstract IRecipeHandler getRecipes(); 72 | 73 | public abstract IQuestHandler getQuests(); 74 | 75 | public abstract IDialogHandler getDialogs(); 76 | 77 | public abstract ICloneHandler getClones(); 78 | 79 | public abstract IDamageSource getIDamageSource(DamageSource damagesource); 80 | 81 | public abstract INbt stringToNbt(String str); 82 | 83 | public abstract IPlayerMail createMail(String sender, String subject); 84 | 85 | /** 86 | * @author Ryan 87 | */ 88 | public abstract ICustomGui createCustomGui(String name, int width, int height, boolean pauseGame, IPlayer player); 89 | 90 | /** 91 | * Get player data even if they are offline 92 | * @param uuid 93 | * @return 94 | */ 95 | public abstract INbt getRawPlayerData(String uuid); 96 | 97 | /** 98 | * Used by modders 99 | * @return The event bus where you register CustomNPCEvents 100 | */ 101 | public abstract IEventBus events(); 102 | 103 | public abstract void registerScriptEvent(Class c); 104 | 105 | /** 106 | * Use to register your own /noppes subcommand 107 | */ 108 | //public abstract void registerCommand(CommandNoppesBase command); 109 | 110 | /** 111 | * @return Returns the .minecraft/customnpcs folder or [yourserverfolder]/customnpcs 112 | */ 113 | public abstract File getGlobalDir(); 114 | 115 | /** 116 | * @return Returns the .minecraft/saves/[yourworld]/customnpcs folder or [yourserverfolder]/[yourworld]/customnpcs 117 | */ 118 | public abstract File getLevelDir(); 119 | 120 | public static boolean IsAvailable(){ 121 | return ModList.get().isLoaded("customnpcs"); 122 | } 123 | 124 | public static NpcAPI Instance(){ 125 | if(instance != null) 126 | return instance; 127 | 128 | if(!IsAvailable()) 129 | return null; 130 | 131 | try { 132 | Class c = Class.forName("noppes.npcs.api.wrapper.WrapperNpcAPI"); 133 | 134 | instance = (NpcAPI) c.getMethod("Instance").invoke(null); 135 | 136 | } catch (Exception e) { 137 | e.printStackTrace(); 138 | } 139 | return instance; 140 | } 141 | 142 | public abstract boolean hasPermissionNode(String permission); 143 | 144 | /** 145 | * @param world The world in which the command is executed 146 | * @param command The Command to execute 147 | * @return 148 | */ 149 | public abstract String executeCommand(IWorld world, String command); 150 | 151 | /** 152 | * @param world The world in which the command is executed 153 | * @param command The Command to execute 154 | * @return 155 | */ 156 | public abstract String executeCommandSilent(IWorld world, String command); 157 | 158 | /** 159 | * @author Nikedemos 160 | * @param dictionary 0:roman, 1:japanese, 2:slavic, 3:welsh, 4:saami, 5:old-norse, 6:ancient-greek, 7:aztec, 8:classic-cnpcs, 9:spanish 161 | * @param gender 0:random, 1:male, 2:female 162 | * @return Returns a randomly generated name 163 | */ 164 | public abstract String getRandomName(int dictionary, int gender); 165 | } 166 | -------------------------------------------------------------------------------- /noppes/npcs/api/block/IBlock.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.block; 2 | 3 | import net.minecraft.world.level.block.Block; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | import net.minecraft.world.level.block.state.BlockState; 6 | import noppes.npcs.api.IContainer; 7 | import noppes.npcs.api.INbt; 8 | import noppes.npcs.api.IPos; 9 | import noppes.npcs.api.IWorld; 10 | import noppes.npcs.api.entity.IEntityLiving; 11 | import noppes.npcs.api.entity.data.IData; 12 | 13 | public interface IBlock { 14 | 15 | int getX(); 16 | 17 | int getY(); 18 | 19 | int getZ(); 20 | 21 | IPos getPos(); 22 | 23 | Object getProperty(String name); 24 | 25 | void setProperty(String name, Object val); 26 | 27 | String[] getProperties(); 28 | 29 | /** 30 | * @return Returns this blocks name 31 | */ 32 | String getName(); 33 | 34 | /** 35 | * Removes this block 36 | */ 37 | void remove(); 38 | 39 | /** 40 | * @return Returns whether or not this block has been replaced by another 41 | */ 42 | boolean isRemoved(); 43 | 44 | boolean isAir(); 45 | 46 | /* 47 | * @param name Sets the block to replace this one using the blocks name 48 | * @return Returns the new block 49 | */ 50 | IBlock setBlock(String name); 51 | 52 | /** 53 | * @param block Sets the block to replace this one 54 | * @return Returns the new block 55 | */ 56 | IBlock setBlock(IBlock block); 57 | 58 | boolean hasTileEntity(); 59 | 60 | /** 61 | * @return Returns whether it has items stored inside it (e.g. chests, droppers, hoppers, etc) 62 | */ 63 | boolean isContainer(); 64 | 65 | IContainer getContainer(); 66 | 67 | /** 68 | * Temp data stores anything but only untill it's reloaded. 69 | * (works only for customnpcs blocks) 70 | */ 71 | IData getTempdata(); 72 | 73 | /** 74 | * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved 75 | * (works only for blocks with TileEntities) 76 | */ 77 | IData getStoreddata(); 78 | 79 | IWorld getWorld(); 80 | 81 | 82 | INbt getBlockEntityNBT(); 83 | 84 | void setTileEntityNBT(INbt nbt); 85 | 86 | /** 87 | * Expert users only 88 | * @return Returns minecrafts tilentity 89 | */ 90 | BlockEntity getMCTileEntity(); 91 | 92 | /** 93 | * Expert users only 94 | * @return Returns minecrafts block 95 | */ 96 | Block getMCBlock(); 97 | 98 | /** 99 | * @param type Event type 100 | * @param data Event data 101 | * Example: 102 | * Chests - type:1 data:1 opens the lid, type:1 data:0 closes the lid 103 | * Note block - type:(0-9) data:(0-24) plays different notes 104 | * 105 | */ 106 | void blockEvent(int type, int data); 107 | 108 | String getDisplayName(); 109 | 110 | /** 111 | * Expert users only 112 | * @return Returns minecrafts iblockstate 113 | */ 114 | BlockState getMCBlockState(); 115 | 116 | /** 117 | * Simulates a player interacting with this block (can give weird results) 118 | * @param side The side of the block interacted with 119 | * @param entity Entity that clicked, can be null 120 | */ 121 | void interact(int side, IEntityLiving entity); 122 | 123 | /** 124 | * Call to let minecraft know to save all changes made in the blocks data 125 | */ 126 | void setChanged(); 127 | } 128 | -------------------------------------------------------------------------------- /noppes/npcs/api/block/IBlockFluidContainer.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.block; 2 | 3 | /** 4 | * Used for certain technical mods which use FluidContainer blocks * 5 | */ 6 | public interface IBlockFluidContainer extends IBlock{ 7 | 8 | float getFluidPercentage(); 9 | 10 | int getFuildDensity(); 11 | 12 | float getFuildTemperature(); 13 | 14 | String getFluidName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /noppes/npcs/api/block/IBlockScripted.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.block; 2 | 3 | import noppes.npcs.api.ITimers; 4 | import noppes.npcs.api.item.IItemStack; 5 | 6 | public interface IBlockScripted extends IBlock{ 7 | 8 | /** 9 | * @param item The item to be set as model 10 | */ 11 | public void setModel(IItemStack item); 12 | 13 | public void setModel(String name); 14 | 15 | public IItemStack getModel(); 16 | 17 | public ITimers getTimers(); 18 | 19 | /** 20 | * @param strength Sets the strength of the redstone signal (0-15) 21 | */ 22 | public void setRedstonePower(int strength); 23 | 24 | /** 25 | * @return Returns the current redstone power (0-15) this block is giving off 26 | */ 27 | public int getRedstonePower(); 28 | 29 | public void setIsLadder(boolean enabled); 30 | 31 | public boolean getIsLadder(); 32 | 33 | /** 34 | * @param value Sets the light value (0-15) 35 | */ 36 | public void setLight(int value); 37 | 38 | /** 39 | * @return Returns the light value (0-15) 40 | */ 41 | public int getLight(); 42 | 43 | /** 44 | * @param x Scale x (0-10) 45 | * @param y Scale y (0-10) 46 | * @param z Scale z (0-10) 47 | */ 48 | public void setScale(float x, float y, float z); 49 | 50 | public float getScaleX(); 51 | 52 | public float getScaleY(); 53 | 54 | public float getScaleZ(); 55 | 56 | /** 57 | * @param x Rotation x (0-359) 58 | * @param y Rotation y (0-359) 59 | * @param z Rotation z (0-359) 60 | */ 61 | public void setRotation(int x, int y, int z); 62 | 63 | public int getRotationX(); 64 | 65 | public int getRotationY(); 66 | 67 | public int getRotationZ(); 68 | 69 | /** 70 | * On servers the enable-command-block option in the server.properties needs to be set to true
71 | * Use /gamerule commandBlockOutput false/true to turn off/on command block feedback
72 | * Setting NpcUseOpCommands to true in the CustomNPCs.cfg should allow the npc to run op commands, be warned this could be a major security risk, use at own risk
73 | * For permission plugins the commands are run under uuid:c9c843f8-4cb1-4c82-aa61-e264291b7bd6 and name:[customnpcs] 74 | * @param command The command to be executed 75 | * @return Returns the commands output 76 | */ 77 | public String executeCommand(String command); 78 | 79 | public boolean getIsPassible(); 80 | 81 | public void setIsPassible(boolean bo); 82 | 83 | /** 84 | * @return Harvesting hardness (-1 makes it unharvestable) 85 | */ 86 | public float getHardness(); 87 | 88 | public void setHardness(float hardness); 89 | 90 | /** 91 | * @return Explosion resistance (-1 makes it unexplodable) 92 | */ 93 | public float getResistance(); 94 | 95 | public void setResistance(float resistance); 96 | 97 | public ITextPlane getTextPlane(); 98 | 99 | public ITextPlane getTextPlane2(); 100 | 101 | public ITextPlane getTextPlane3(); 102 | 103 | public ITextPlane getTextPlane4(); 104 | 105 | public ITextPlane getTextPlane5(); 106 | 107 | public ITextPlane getTextPlane6(); 108 | 109 | /** 110 | * Fires trigger event for block scripts 111 | * @param id, Id for the event 112 | * @param arguments, arguments you can give with it 113 | */ 114 | public void trigger(int id, Object... arguments); 115 | } 116 | -------------------------------------------------------------------------------- /noppes/npcs/api/block/IBlockScriptedDoor.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.block; 2 | 3 | import noppes.npcs.api.ITimers; 4 | 5 | public interface IBlockScriptedDoor extends IBlock{ 6 | 7 | public ITimers getTimers(); 8 | 9 | public boolean getOpen(); 10 | 11 | public void setOpen(boolean open); 12 | 13 | /** 14 | * @param name The items name for the blocks model to be set 15 | */ 16 | public void setBlockModel(String name); 17 | 18 | public String getBlockModel(); 19 | 20 | /** 21 | * @return Harvesting hardness (-1 makes it unharvestable) 22 | */ 23 | public float getHardness(); 24 | 25 | public void setHardness(float hardness); 26 | 27 | /** 28 | * @return Explosion resistance (-1 makes it unexplodable) 29 | */ 30 | public float getResistance(); 31 | 32 | public void setResistance(float resistance); 33 | 34 | /** 35 | * On servers the enable-command-block option in the server.properties needs to be set to true
36 | * Use /gamerule commandBlockOutput false/true to turn off/on command block feedback
37 | * Setting NpcUseOpCommands to true in the CustomNPCs.cfg should allow the npc to run op commands, be warned this could be a major security risk, use at own risk
38 | * For permission plugins the commands are run under uuid:c9c843f8-4cb1-4c82-aa61-e264291b7bd6 and name:[customnpcs] 39 | * @param command The command to be executed 40 | * @return Returns the commands output 41 | */ 42 | public String executeCommand(String command); 43 | } 44 | -------------------------------------------------------------------------------- /noppes/npcs/api/block/ITextPlane.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.block; 2 | 3 | public interface ITextPlane { 4 | 5 | public String getText(); 6 | 7 | public void setText(String text); 8 | 9 | public int getRotationX(); 10 | 11 | public int getRotationY(); 12 | 13 | public int getRotationZ(); 14 | 15 | public void setRotationX(int x); 16 | 17 | public void setRotationY(int y); 18 | 19 | /** 20 | * @param z Default: 0.5 21 | */ 22 | public void setRotationZ(int z); 23 | 24 | public float getOffsetX(); 25 | 26 | public float getOffsetY(); 27 | 28 | public float getOffsetZ(); 29 | 30 | public void setOffsetX(float x); 31 | 32 | public void setOffsetY(float y); 33 | 34 | public void setOffsetZ(float z); 35 | 36 | public float getScale(); 37 | 38 | /** 39 | * @param scale Default: 1 40 | */ 41 | public void setScale(float scale); 42 | } 43 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/AnimationType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * Animation Types 8 | */ 9 | public class AnimationType { 10 | public static final int NONE = 0; 11 | public static final int SIT = 1; 12 | public static final int SLEEP = 2; 13 | public static final int HUG = 3; 14 | public static final int CROUCH = 4; 15 | public static final int DANCE = 5; 16 | public static final int AIM = 6; 17 | public static final int CRAWL = 7; 18 | public static final int POINT = 8; 19 | public static final int CRY = 9; 20 | public static final int WAVE = 10; 21 | public static final int BOW = 11; 22 | public static final int NO = 12; 23 | public static final int YES = 13; 24 | public static final int DEATH = 14; 25 | public static final int WALK = 15; 26 | public static final int IDLE = 16; 27 | public static final int FLY = 17; 28 | public static final int FLY_IDLE = 18; 29 | public static final int STATIC = 19; 30 | public static final int SWIM = 20; 31 | public static final int WAG = 21; 32 | 33 | public static Map ALL = new HashMap<>(); 34 | 35 | static { 36 | ALL.put("NONE", NONE); 37 | ALL.put("SIT", SIT); 38 | ALL.put("SLEEP", SLEEP); 39 | ALL.put("HUG", HUG); 40 | ALL.put("CROUCH", CROUCH); 41 | ALL.put("DANCE", DANCE); 42 | ALL.put("AIM", AIM); 43 | ALL.put("CRAWL", CRAWL); 44 | ALL.put("POINT", POINT); 45 | ALL.put("CRY", CRY); 46 | ALL.put("WAVE", WAVE); 47 | ALL.put("BOW", BOW); 48 | ALL.put("NO", NO); 49 | ALL.put("YES", YES); 50 | ALL.put("DEATH", DEATH); 51 | ALL.put("WALK", WALK); 52 | ALL.put("IDLE", IDLE); 53 | ALL.put("FLY", FLY); 54 | ALL.put("FLY_IDLE", FLY_IDLE); 55 | ALL.put("STATIC", STATIC); 56 | ALL.put("SWIM", SWIM); 57 | ALL.put("WAG", WAG); 58 | } 59 | 60 | public static int valueOf(String name) { 61 | if(ALL.containsKey(name.toUpperCase())){ 62 | return ALL.get(name.toUpperCase()); 63 | } 64 | return NONE; 65 | } 66 | 67 | public static String nameOf(int animation) { 68 | for(Map.Entry en : ALL.entrySet()){ 69 | if(en.getValue() == animation){ 70 | return en.getKey(); 71 | } 72 | } 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/EntitiesType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | /** 4 | * Entity Types 5 | */ 6 | public class EntitiesType { 7 | public static final int ANY = -1; 8 | public static final int UNKNOWN = 0; 9 | public static final int PLAYER = 1; 10 | public static final int NPC = 2; 11 | public static final int MONSTER = 3; 12 | public static final int ANIMAL = 4; 13 | public static final int LIVING = 5; 14 | public static final int ITEM = 6; 15 | public static final int PROJECTILE = 7; 16 | public static final int PIXELMON = 8; 17 | public static final int VILLAGER = 9; 18 | public static final int ARROW = 10; 19 | public static final int THROWABLE = 11; 20 | } 21 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/GuiComponentType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | public class GuiComponentType { 4 | public static final int BUTTON = 0; 5 | public static final int LABEL = 1; 6 | public static final int TEXTURED_RECT = 2; 7 | public static final int TEXT_FIELD = 3; 8 | public static final int SCROLL = 4; 9 | public static final int ITEM_SLOT = 5; 10 | public static final int TEXT_AREA = 6; 11 | public static final int BUTTON_LIST = 7; 12 | public static final int SLIDER = 8; 13 | public static final int ENTITY_DISPLAY = 9; 14 | public static final int ASSETS_SELECTOR = 10; 15 | } 16 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/ItemType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | /** 3 | * Item Types 4 | */ 5 | public class ItemType { 6 | public static final int NORMAL = 0; 7 | public static final int BOOK = 1; 8 | public static final int BLOCK = 2; 9 | public static final int ARMOR = 3; 10 | public static final int SWORD = 4; 11 | public static final int SEEDS = 5; 12 | public static final int SCRIPTED = 6; 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/JobType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | /** 3 | * Job Types 4 | */ 5 | public class JobType { 6 | public static final int NONE = 0; 7 | public static final int BARD = 1; 8 | public static final int HEALER = 2; 9 | public static final int GUARD = 3; 10 | public static final int ITEMGIVER = 4; 11 | public static final int FOLLOWER = 5; 12 | public static final int SPAWNER = 6; 13 | public static final int CONVERSATION = 7; 14 | public static final int CHUNKLOADER = 8; 15 | public static final int PUPPET = 9; 16 | public static final int BUILDER = 10; 17 | public static final int FARMER = 11; 18 | 19 | 20 | public static final int MAXSIZE = 12; 21 | } 22 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/MarkType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | public class MarkType { 4 | public static final int NONE = 0; 5 | public static final int QUESTION = 1; 6 | public static final int EXCLAMATION = 2; 7 | public static final int POINTER = 3; 8 | public static final int SKULL = 4; 9 | public static final int CROSS = 5; 10 | public static final int STAR = 6; 11 | } 12 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/MenuNames.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | public class MenuNames { 4 | 5 | public static final String GLOBAL_EDIT = "global_edit"; 6 | public static final String DIALOG_EDIT = "dialog_edit"; 7 | public static final String DIALOG_GLOBAL = "dialog_global"; 8 | public static final String DIALOG_OPTION_EDIT = "dialog_option_edit"; 9 | public static final String DIALOG_OPTIONS_EDIT = "dialog_options_edit"; 10 | public static final String FACTION_EDIT = "faction_edit"; 11 | public static final String FACTION_GLOBAL = "faction_global"; 12 | public static final String FACTION_OPTIONS_EDIT = "faction_options_edit"; 13 | public static final String QUEST_EDIT = "quest_edit"; 14 | public static final String QUEST_REWARDS = "quest_rewards"; 15 | public static final String QUEST_COMPLETE = "quest_complete"; 16 | public static final String QUEST_GLOBAL = "quest_global"; 17 | public static final String QUEST_TYPE_DIALOG = "quest_type_dialog"; 18 | public static final String QUEST_TYPE_ITEM = "quest_type_item"; 19 | public static final String QUEST_TYPE_KILL = "quest_type_kill"; 20 | public static final String QUEST_TYPE_LOCATION = "quest_type_location"; 21 | public static final String QUEST_TYPE_MANUAL = "quest_type_manual"; 22 | public static final String LINE_EDIT = "line_edit"; 23 | public static final String PLAYERDATA_EDIT = "playerdata_edit"; 24 | public static final String SPAWNDATA_EDIT = "spawndata_edit"; 25 | public static final String SPAWNDATA_GLOBAL = "spawndata_global"; 26 | 27 | public static final String NPC_REMOTE_EDIT = "npc_remote_edit"; 28 | public static final String NPC_EDIT_DISPLAY = "npc_edit_display"; 29 | public static final String NPC_EDIT_NAME = "npc_edit_name"; 30 | public static final String NPC_EDIT_LOGIC = "npc_edit_logic"; 31 | public static final String NPC_EDIT_LINES = "npc_edit_lines"; 32 | public static final String NPC_EDIT_LINkED = "npc_edit_linked"; 33 | public static final String NPC_EDIT_DIALOGS = "npc_edit_dialogs"; 34 | public static final String NPC_EDIT_SOUNDS = "npc_edit_sounds"; 35 | public static final String NPC_EDIT_NIGHT = "npc_edit_night"; 36 | public static final String NPC_EDIT_MARKS = "npc_edit_marks"; 37 | public static final String NPC_EDIT_SCENES = "npc_edit_scenes"; 38 | public static final String NPC_EDIT_DEATH = "npc_edit_death"; 39 | public static final String NPC_EDIT_HEALTH = "npc_edit_health"; 40 | public static final String NPC_EDIT_INVENTORY = "npc_edit_inventory"; 41 | public static final String NPC_EDIT_MELEE = "npc_edit_melee"; 42 | public static final String NPC_EDIT_MODEL = "npc_edit_model"; 43 | public static final String NPC_EDIT_MOVEMENT = "npc_edit_movement"; 44 | 45 | public static final String ROLE_NONE = "role_none"; 46 | public static final String ROLE_TRADER_EDIT = "role_trader_edit"; 47 | public static final String ROLE_TRADER = "role_trader"; 48 | public static final String ROLE_FOLLOWER_EDIT = "role_follower_edit"; 49 | public static final String ROLE_FOLLOWER_HIRE = "role_follower_hire"; 50 | public static final String ROLE_FOLLOWER_VIEW = "role_follower_view"; 51 | public static final String ROLE_BANK_EDIT = "role_bank_edit"; 52 | public static final String ROLE_BANK = "role_bank"; 53 | public static final String ROLE_TRANSPORTER_EDIT = "role_transporter_edit"; 54 | public static final String ROLE_TRANSPORTER = "role_transporter"; 55 | public static final String ROLE_COMPANION_EDIT = "role_companion_edit"; 56 | public static final String ROLE_DIALOG_EDIT = "role_dialog_edit"; 57 | public static final String ROLE_COMPANION_STATS = "role_companion_stats"; 58 | public static final String ROLE_COMPANION_TALENTS = "role_companion_talents"; 59 | public static final String ROLE_COMPANION_INVENTORY = "role_companion_inventory"; 60 | public static final String ROLE_MAILMAN_SEND = "role_mailman_send"; 61 | public static final String ROLE_MAILMAN_LIST = "role_mailman_list"; 62 | public static final String ROLE_MAILMAN_READ = "role_mailman_read"; 63 | public static final String ROLE_MAILMAN_INVENTORY = "role_mailman_inventory"; 64 | 65 | public static final String JOB_NONE = "job_none"; 66 | public static final String JOB_BARD_EDIT = "job_bard_edit"; 67 | public static final String JOB_BEACON_EDIT = "job_beacon_edit"; 68 | public static final String JOB_BEACON_ADD_EFFECT = "job_beacon_add_effect"; 69 | public static final String JOB_GUARD_EDIT = "job_guard_edit"; 70 | public static final String JOB_GUARD_ADD_ENTITY = "job_guard_add_entity"; 71 | public static final String JOB_ITEMGIVER_EDIT = "job_itemgiver_edit"; 72 | public static final String JOB_ITEMGIVER_ADD_ITEM = "job_itemgiver_add_item"; 73 | public static final String JOB_FOLLOWER_EDIT = "job_follower_edit"; 74 | public static final String JOB_SPAWNER_EDIT = "job_spawner_edit"; 75 | public static final String JOB_CONVERSATION_EDIT = "job_conversation_edit"; 76 | public static final String JOB_PUPPET_EDIT = "job_puppet_edit"; 77 | public static final String JOB_FARMER_EDIT = "job_farmer_edit"; 78 | 79 | public static final String SCRIPT_GLOBAL = "script_global"; 80 | public static final String SCRIPT_NPC_EDIT = "script_npc_edit"; 81 | public static final String SCRIPT_BLOCK_EDIT = "script_block_edit"; 82 | public static final String SCRIPT_DOOR_EDIT = "script_door_edit"; 83 | public static final String SCRIPT_FORGE_EDIT = "script_forge_edit"; 84 | public static final String SCRIPT_PLAYER_EDIT = "script_player_edit"; 85 | public static final String SCRIPT_ITEM_EDIT = "script_item_edit"; 86 | 87 | public static final String SELECT_TEXTURE = "select_texture"; 88 | public static final String SELECT_CLOAK = "select_cloak"; 89 | public static final String SELECT_SOUND = "select_sound"; 90 | public static final String SELECT_SCHEMATIC = "select_schematic"; 91 | public static final String SELECT_FACTION = "select_faction"; 92 | public static final String SELECT_DIALOG = "select_dialog"; 93 | public static final String SELECT_QUEST = "select_quest"; 94 | public static final String SELECT_CLONE = "select_clone"; 95 | public static final String SELECT_ENTITY = "select_entity"; 96 | 97 | public static final String AVAILABILITY_EDIT = "availability_edit"; 98 | public static final String AVAILABILITY_DIALOG_EDIT = "availability_dialog_edit"; 99 | public static final String AVAILABILITY_QUEST_EDIT = "availability_quest_edit"; 100 | public static final String AVAILABILITY_SCOREBOARD_EDIT = "availability_scoreboard_edit"; 101 | 102 | public static final String GENERIC_TEXTFIELD = "generic_textfield"; 103 | public static final String GENERIC_TEXTFIELD_ADD = "generic_textfield_add"; 104 | public static final String GENERIC_TEXTAREA = "generic_textarea"; 105 | public static final String GENERIC_TEXTAREA_ADD = "generic_textarea_add"; 106 | public static final String GENERIC_TEXTAREA_STYLED = "generic_textarea_styled"; 107 | public static final String GENERIC_YES_NO = "generic_yes_no"; 108 | public static final String GENERIC_LIST = "generic_list"; 109 | public static final String GENERIC_DELETE = "generic_delete"; 110 | public static final String GENERIC_COLOR_PICKER = "generic_color_picker"; 111 | public static final String GENERIC_COMMANDS_EDITOR = "generic_commands_editor"; 112 | public static final String GENERIC_DOUBLE_LIST = "generic_double_list"; 113 | 114 | public static final String BLOCK_BORDER_EDIT = "block_border_edit"; 115 | public static final String BLOCK_BUILDER_EDIT = "block_builder_edit"; 116 | public static final String BLOCK_COPY_EDIT = "block_copy_edit"; 117 | public static final String BLOCK_REDSTONE_EDIT = "block_redstone_edit"; 118 | public static final String BLOCK_WAYPOINT_EDIT = "block_waypoint_edit"; 119 | public static final String ITEM_NBTBOOK_EDIT_ENTITY = "item_nbtbook_edit_entity"; 120 | public static final String ITEM_NBTBOOK_EDIT_BLOCK = "item_nbtbook_edit_block"; 121 | public static final String ITEM_MOUNTER_EDIT = "item_mounter_edit"; 122 | public static final String ITEM_CLONER_CREATE = "item_cloner_create"; 123 | public static final String ITEM_CLONER_SPAWN = "item_cloner_spawn"; 124 | public static final String ITEM_MOVINGPATH_EDIT = "item_movingpath_edit"; 125 | public static final String ITEM_TELEPORTER = "item_teleporter"; 126 | 127 | } 128 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/OptionType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | public class OptionType { 4 | public static final int QUIT_OPTION = 0; 5 | public static final int DIALOG_OPTION = 1; 6 | public static final int DISABLED = 2; 7 | public static final int ROLE_OPTION = 3; 8 | } 9 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/PotionEffectType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | import net.minecraft.core.Registry; 4 | import net.minecraft.world.effect.MobEffect; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public final class PotionEffectType { 10 | public static final int NONE = 0; 11 | public static final int FIRE = 666; 12 | 13 | 14 | public static final int SPEED = 1; 15 | public static final int SLOWNESS = 2; 16 | public static final int HASTE = 3; 17 | public static final int MINING_FATIGUE = 4; 18 | public static final int STRENGTH = 5; 19 | public static final int INSTANT_HEALTH = 6; 20 | public static final int INSTANT_DAMAGE = 7; 21 | public static final int JUMP_BOOST = 8; 22 | public static final int NAUSEA = 9; 23 | public static final int REGENERATION = 10; 24 | public static final int RESISTANCE = 11; 25 | public static final int FIRE_RESISTANCE = 12; 26 | public static final int WATER_BREATHING = 13; 27 | public static final int INVISIBILITY = 14; 28 | public static final int BLINDNESS = 15; 29 | public static final int NIGHT_VISION = 16; 30 | public static final int HUNGER = 17; 31 | public static final int WEAKNESS = 18; 32 | public static final int POISON = 19; 33 | public static final int WITHER = 20; 34 | public static final int HEALTH_BOOST = 21; 35 | public static final int ABSORPTION = 22; 36 | public static final int SATURATION = 23; 37 | public static final int GLOWING = 24; 38 | public static final int LEVITATION = 25; 39 | public static final int LUCK = 26; 40 | public static final int UNLUCK = 27; 41 | public static final int SLOW_FALLING = 28; 42 | public static final int CONDUIT_POWER = 29; 43 | public static final int DOLPHINS_GRACE = 30; 44 | public static final int BAD_OMEN = 31; 45 | public static final int HERO_OF_THE_VILLAGE = 32; 46 | 47 | 48 | 49 | public static MobEffect getMCType(int effect) { 50 | if(effect == NONE || effect == FIRE) 51 | return null; 52 | 53 | return Registry.MOB_EFFECT.byId(effect); 54 | } 55 | 56 | public static List getMCAllTypes() { 57 | List list = new ArrayList<>(); 58 | for(int i = 1; i <= 32; i++){ 59 | list.add(getMCType(i)); 60 | } 61 | return list; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/QuestType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | public class QuestType { 4 | public static final int ITEM = 0; 5 | public static final int DIALOG = 1; 6 | public static final int KILL = 2; 7 | public static final int LOCATION = 3; 8 | public static final int AREA_KILL = 4; 9 | public static final int MANUAL = 5; 10 | } 11 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/RoleType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | 3 | /** 4 | * Role Types 5 | */ 6 | public class RoleType { 7 | public static final int NONE = 0; 8 | public static final int TRADER = 1; 9 | public static final int FOLLOWER = 2; 10 | public static final int BANK = 3; 11 | public static final int TRANSPORTER = 4; 12 | public static final int MAILMAN = 5; 13 | public static final int COMPANION = 6; 14 | public static final int DIALOG = 7; 15 | 16 | public static final int MAXSIZE = 8; 17 | } 18 | -------------------------------------------------------------------------------- /noppes/npcs/api/constants/SideType.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.constants; 2 | /** 3 | * Facing Types 4 | */ 5 | public class SideType { 6 | public static final int DOWN = 0; 7 | public static final int UP = 1; 8 | public static final int NORTH = 2; 9 | public static final int SOUTH = 3; 10 | public static final int WEST = 4; 11 | public static final int EAST = 5; 12 | } 13 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IAnimal.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.animal.Animal; 4 | 5 | public interface IAnimal extends IMob { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IArrow.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.projectile.AbstractArrow; 4 | 5 | public interface IArrow extends IEntity{ 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/ICustomNpc.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.Mob; 4 | import noppes.npcs.api.ITimers; 5 | import noppes.npcs.api.entity.data.INPCAdvanced; 6 | import noppes.npcs.api.entity.data.INPCAi; 7 | import noppes.npcs.api.entity.data.INPCDisplay; 8 | import noppes.npcs.api.entity.data.INPCInventory; 9 | import noppes.npcs.api.entity.data.INPCJob; 10 | import noppes.npcs.api.entity.data.INPCRole; 11 | import noppes.npcs.api.entity.data.INPCStats; 12 | import noppes.npcs.api.handler.data.IDialog; 13 | import noppes.npcs.api.handler.data.IFaction; 14 | import noppes.npcs.api.item.IItemStack; 15 | 16 | public interface ICustomNpc extends IMob { 17 | 18 | public INPCDisplay getDisplay(); 19 | 20 | public INPCInventory getInventory(); 21 | 22 | public INPCStats getStats(); 23 | 24 | public INPCAi getAi(); 25 | 26 | public INPCAdvanced getAdvanced(); 27 | 28 | public IFaction getFaction(); 29 | 30 | public void setFaction(int id); 31 | 32 | public INPCRole getRole(); 33 | 34 | public INPCJob getJob(); 35 | 36 | public ITimers getTimers(); 37 | 38 | public int getHomeX(); 39 | 40 | public int getHomeY(); 41 | 42 | public int getHomeZ(); 43 | 44 | /** 45 | * @return Incase the npc is a Follower or Companion it will return the one who its following. Also works for scene followers 46 | */ 47 | public IEntityLiving getOwner(); 48 | 49 | public void setHome(int x, int y, int z); 50 | 51 | /** 52 | * Basically completely resets the npc. This will also call the Init script 53 | */ 54 | public void reset(); 55 | 56 | public void say(String message); 57 | 58 | public void sayTo(IPlayer player, String message); 59 | 60 | /** 61 | * @param item The item you want to shoot 62 | * @param accuracy Accuracy of the shot (1-100) 63 | */ 64 | public IProjectile shootItem(IEntityLiving target, IItemStack item, int accuracy); 65 | 66 | /** 67 | * @param item The item you want to shoot 68 | * @param accuracy Accuracy of the shot (1-100) 69 | * @return 70 | */ 71 | public IProjectile shootItem(double x, double y, double z, IItemStack item, int accuracy); 72 | 73 | /** 74 | * If the player can't carry the item it will fall on the ground. (unless the player is in creative) 75 | */ 76 | public void giveItem(IPlayer player, IItemStack item); 77 | 78 | /** 79 | * @param slot (0-11) 80 | */ 81 | public void setDialog(int slot, IDialog dialog); 82 | 83 | /** 84 | * @param slot (0-11) 85 | */ 86 | public IDialog getDialog(int slot); 87 | 88 | /** 89 | * Force update client. Normally it updates client once every 10 ticks 90 | */ 91 | public void updateClient(); 92 | 93 | /** 94 | * On servers the enable-command-block option in the server.properties needs to be set to true
95 | * Use /gamerule commandBlockOutput false/true to turn off/on command block feedback
96 | * Setting NpcUseOpCommands to true in the CustomNPCs.cfg should allow the npc to run op commands, be warned this could be a major security risk, use at own risk
97 | * For permission plugins the commands are run under uuid:c9c843f8-4cb1-4c82-aa61-e264291b7bd6 and name:[customnpcs] 98 | * @param command The command to be executed 99 | * @return Returns the commands output 100 | */ 101 | public String executeCommand(String command); 102 | 103 | /** 104 | * Fires trigger event for npc scripts 105 | * @param id, Id for the event 106 | * @param arguments, arguments you can give with it 107 | */ 108 | public void trigger(int id, Object... arguments); 109 | 110 | } 111 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IEntity.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import noppes.npcs.api.INbt; 5 | import noppes.npcs.api.IPos; 6 | import noppes.npcs.api.IRayTrace; 7 | import noppes.npcs.api.IWorld; 8 | import noppes.npcs.api.constants.EntitiesType; 9 | import noppes.npcs.api.entity.data.IData; 10 | import noppes.npcs.api.item.IItemStack; 11 | 12 | public interface IEntity { 13 | 14 | public double getX(); 15 | 16 | public void setX(double x); 17 | 18 | public double getY(); 19 | 20 | public void setY(double y); 21 | 22 | public double getZ(); 23 | 24 | public void setZ(double z); 25 | 26 | public int getBlockX(); 27 | 28 | public int getBlockY(); 29 | 30 | public int getBlockZ(); 31 | 32 | public IPos getPos(); 33 | 34 | public void setPos(IPos pos); 35 | 36 | public void setPosition(double x, double y, double z); 37 | 38 | /** 39 | * @param rotation The rotation to be set (0-360) 40 | */ 41 | public void setRotation(float rotation); 42 | 43 | /** 44 | * @return Current rotation of the entity 45 | */ 46 | public float getRotation(); 47 | 48 | /** 49 | * @return Returns the height of the bounding box 50 | */ 51 | public float getHeight(); 52 | 53 | /** 54 | * @return Returns the eye height of the entity, used in this like canSee and such 55 | */ 56 | public float getEyeHeight(); 57 | 58 | /** 59 | * @return Returns the width of the bounding box 60 | */ 61 | public float getWidth(); 62 | 63 | /** 64 | * @param pitch The viewing pitch 65 | */ 66 | public void setPitch(float pitch); 67 | 68 | /** 69 | * @return Entities viewing pitch 70 | */ 71 | public float getPitch(); 72 | 73 | public IEntity getMount(); 74 | 75 | public void setMount(IEntity entity); 76 | 77 | /** 78 | * @return Returns the entities riding this entity 79 | */ 80 | public IEntity[] getRiders(); 81 | 82 | /** 83 | * @return Returns the entities riding this entity including the entities riding those entities 84 | */ 85 | public IEntity[] getAllRiders(); 86 | 87 | public void addRider(IEntity entity); 88 | 89 | public void clearRiders(); 90 | 91 | /** 92 | * @param power How strong the knockback is 93 | * @param direction The direction in which he flies back (0-360). Usually based on getRotation() 94 | */ 95 | public void knockback(int power, float direction); 96 | 97 | public boolean isSneaking(); 98 | 99 | public boolean isSprinting(); 100 | 101 | public IEntityItem dropItem(IItemStack item); 102 | 103 | public boolean inWater(); 104 | 105 | public boolean inFire(); 106 | 107 | public boolean inLava(); 108 | 109 | /** 110 | * Temp data stores anything but only untill it's reloaded 111 | */ 112 | public IData getTempdata(); 113 | 114 | /** 115 | * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved 116 | */ 117 | public IData getStoreddata(); 118 | 119 | /** 120 | * The Entity's extra stored NBT data 121 | * @return The Entity's extra stored NBT data 122 | */ 123 | public INbt getNbt(); 124 | 125 | public boolean isAlive(); 126 | /** 127 | * @return The age of this entity in ticks 128 | */ 129 | public long getAge(); 130 | 131 | /** 132 | * Despawns this entity. Removes it permanently 133 | */ 134 | public void despawn(); 135 | 136 | /** 137 | * Spawns this entity into the world (For NPCs dont forget to set their home position) 138 | */ 139 | public void spawn(); 140 | 141 | /** 142 | * Kill the entity, doesnt't despawn it 143 | */ 144 | public void kill(); 145 | 146 | /** 147 | * @return Return whether or not this entity is on fire 148 | */ 149 | public boolean isBurning(); 150 | 151 | /** 152 | * @param seconds Amount of seconds this entity will burn. 153 | */ 154 | public void setBurning(int seconds); 155 | 156 | /** 157 | * Removes fire from this entity 158 | */ 159 | public void extinguish(); 160 | 161 | /** 162 | * @return Returns the {@link noppes.npcs.api.IWorld} 163 | */ 164 | public IWorld getWorld(); 165 | 166 | /** 167 | * @return Name as which it's registered in minecraft 168 | */ 169 | public String getTypeName(); 170 | /** 171 | * @return Returns the {@link EntitiesType} of this entity 172 | */ 173 | public int getType(); 174 | 175 | /** 176 | * @param type {@link EntitiesType} to check 177 | * @return Returns whether the entity is type of the given {@link EntitiesType} 178 | */ 179 | public boolean typeOf(int type); 180 | 181 | /** 182 | * Expert users only 183 | * @return Returns minecrafts entity 184 | */ 185 | public T getMCEntity(); 186 | 187 | public String getUUID(); 188 | 189 | public String generateNewUUID(); 190 | 191 | /** 192 | * Stores the entity as clone server side 193 | * @param tab 194 | * @param name 195 | */ 196 | public void storeAsClone(int tab, String name); 197 | 198 | /** 199 | * This is not a function you should be calling every tick. 200 | * Returns the entire entity as nbt 201 | */ 202 | public INbt getEntityNbt(); 203 | 204 | /** 205 | * This is not a function you should be calling every tick 206 | */ 207 | public void setEntityNbt(INbt nbt); 208 | 209 | /** 210 | * Gets the first block within distance the npc is looking at 211 | * @param distance 212 | * @param stopOnLiquid 213 | * @param ignoreBlockWithoutBoundingBox 214 | * @return 215 | */ 216 | public IRayTrace rayTraceBlock(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox); 217 | 218 | /** 219 | * Gets the entities within distance the npc is looking at sorted by distance 220 | * @param distance 221 | * @param stopOnLiquid 222 | * @param ignoreBlockWithoutBoundingBox 223 | * @return 224 | */ 225 | public IEntity[] rayTraceEntities(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox); 226 | 227 | /** 228 | * Tags are used by scoreboards and can be used in commands 229 | */ 230 | public String[] getTags(); 231 | 232 | public void addTag(String tag); 233 | 234 | public boolean hasTag(String tag); 235 | 236 | public void removeTag(String tag); 237 | 238 | /** 239 | * Play specific minecraft animations client side 240 | * 0 and 3 are for LivingEntity entities and 2 is only for players 241 | * @param type 0:Swing main hand, 1:Hurt animation, 2:Wakeup Player 3:Swing offhand hand, 4:Crit particle, 5:Spell crit particle 242 | */ 243 | public void playAnimation(int type); 244 | 245 | public void damage(float amount); 246 | 247 | public double getMotionX(); 248 | 249 | public double getMotionY(); 250 | 251 | public double getMotionZ(); 252 | 253 | public void setMotionX(double motion); 254 | 255 | public void setMotionY(double motion); 256 | 257 | public void setMotionZ(double motion); 258 | 259 | /** 260 | * @return Returns the current name displayed by the entity 261 | */ 262 | public String getName(); 263 | 264 | /** 265 | * @param name Set a custom name for this entity 266 | */ 267 | public void setName(String name); 268 | 269 | public boolean hasCustomName(); 270 | 271 | /** 272 | * @return Returns the original name incase a custom name has been set 273 | */ 274 | public String getEntityName(); 275 | } 276 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IEntityItem.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.item.ItemEntity; 4 | import noppes.npcs.api.item.IItemStack; 5 | 6 | public interface IEntityItem extends IEntity{ 7 | 8 | /** 9 | * @return The owner of the item, only the owner can pick the item up 10 | */ 11 | public String getOwner(); 12 | 13 | /** 14 | * @param name The UUID for the owner of the item, only the owner can pick up the item 15 | * (note that the item can also be picked up if the lifetime - age is equal or smaller than 200) 16 | */ 17 | public void setOwner(String name); 18 | 19 | /** 20 | * @return Ticks remaining before it can be picked up (32767 is infinite) 21 | */ 22 | public int getPickupDelay(); 23 | 24 | /** 25 | * @param delay Delay before the item can be picked up (32767 is infinite delay) 26 | */ 27 | public void setPickupDelay(int delay); 28 | 29 | /** 30 | * @return Returns the age of the item 31 | */ 32 | public long getAge(); 33 | 34 | /** 35 | * @param age Age of the item (-32767 is infinite age) 36 | */ 37 | public void setAge(long age); 38 | 39 | /** 40 | * @return When the age reaches this the item despawns 41 | */ 42 | public int getLifeSpawn(); 43 | 44 | /** 45 | * @param age Age at which the item despawns 46 | */ 47 | public void setLifeSpawn(int age); 48 | 49 | public IItemStack getItem(); 50 | 51 | public void setItem(IItemStack item); 52 | } 53 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IEntityLiving.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.LivingEntity; 4 | import noppes.npcs.api.entity.data.IMark; 5 | import noppes.npcs.api.item.IItemStack; 6 | 7 | public interface IEntityLiving extends IEntity{ 8 | 9 | public float getHealth(); 10 | 11 | public void setHealth(float health); 12 | 13 | public float getMaxHealth(); 14 | 15 | public void setMaxHealth(float health); 16 | 17 | public boolean isAttacking(); 18 | 19 | public void setAttackTarget(IEntityLiving living); 20 | 21 | public IEntityLiving getAttackTarget(); 22 | 23 | /** 24 | * @return Returns the last Entity this Entity attacked 25 | */ 26 | public IEntityLiving getLastAttacked(); 27 | 28 | /** 29 | * @return Returns the age of this entity when it was last attacked 30 | */ 31 | public int getLastAttackedTime(); 32 | 33 | public boolean canSeeEntity(IEntity entity); 34 | 35 | public void swingMainhand(); 36 | 37 | public void swingOffhand(); 38 | 39 | public IItemStack getMainhandItem(); 40 | 41 | public void setMainhandItem(IItemStack item); 42 | 43 | public IItemStack getOffhandItem(); 44 | 45 | public void setOffhandItem(IItemStack item); 46 | 47 | /** 48 | * Note not all Living Entities support this 49 | * @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head 50 | * @return The item in the given slot 51 | */ 52 | public IItemStack getArmor(int slot); 53 | 54 | /** 55 | * @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head 56 | * @param item Item to be set 57 | */ 58 | public void setArmor(int slot, IItemStack item); 59 | 60 | /** 61 | * Works the same as the /effect command 62 | * @param effect 63 | * @param duration The duration in seconds 64 | * @param strength The amplifier of the potion effect 65 | * @param showParticles Whether you want to hide potion particles 66 | */ 67 | public void addPotionEffect(int effect, int duration, int strength, boolean showParticles); 68 | 69 | public void clearPotionEffects(); 70 | 71 | public int getPotionEffect(int effect); 72 | 73 | public IMark addMark(int type); 74 | 75 | public void removeMark(IMark mark); 76 | 77 | public IMark[] getMarks(); 78 | 79 | public boolean isChild(); 80 | 81 | @Override 82 | public T getMCEntity(); 83 | 84 | public float getMoveForward(); 85 | 86 | public void setMoveForward(float move); 87 | 88 | public float getMoveStrafing(); 89 | 90 | public void setMoveStrafing(float move); 91 | 92 | public float getMoveVertical(); 93 | 94 | public void setMoveVertical(float move); 95 | } 96 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IMob.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.Mob; 4 | import noppes.npcs.api.IPos; 5 | 6 | public interface IMob extends IEntityLiving { 7 | 8 | /** 9 | * @return Whether or not this entity is navigating somewhere 10 | */ 11 | public boolean isNavigating(); 12 | 13 | /** 14 | * Stop navigating wherever this npc was walking to 15 | */ 16 | public void clearNavigation(); 17 | 18 | /** 19 | * Start path finding toward this target 20 | * @param x Destination x position 21 | * @param y Destination x position 22 | * @param z Destination x position 23 | */ 24 | public void navigateTo(double x, double y, double z, double speed); 25 | 26 | public void jump(); 27 | 28 | @Override 29 | public T getMCEntity(); 30 | 31 | public IPos getNavigationPath(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IMonster.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.Mob; 4 | 5 | public interface IMonster extends IMob { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IPixelmon.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.world.entity.TamableAnimal; 4 | 5 | public interface IPixelmon extends IAnimal { 6 | 7 | /** 8 | * Returns a Pokemon object 9 | */ 10 | public Object getPokemonData(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/IPlayer.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity; 2 | 3 | import net.minecraft.server.level.ServerPlayer; 4 | import noppes.npcs.api.IContainer; 5 | import noppes.npcs.api.ITimers; 6 | import noppes.npcs.api.block.IBlock; 7 | import noppes.npcs.api.entity.data.IPlayerMail; 8 | import noppes.npcs.api.gui.ICustomGui; 9 | import noppes.npcs.api.handler.data.IQuest; 10 | import noppes.npcs.api.item.IItemStack; 11 | 12 | public interface IPlayer extends IEntityLiving { 13 | 14 | String getDisplayName(); 15 | 16 | boolean hasFinishedQuest(int id); 17 | 18 | boolean hasActiveQuest(int id); 19 | 20 | void startQuest(int id); 21 | 22 | /** 23 | * @return Returns -1:Unfriendly, 0:Neutral, 1:Friendly 24 | */ 25 | int factionStatus(int factionId); 26 | 27 | /** 28 | * Add the quest from finished quest list 29 | * @param id The Quest ID 30 | */ 31 | void finishQuest(int id); 32 | 33 | /** 34 | * Removes the quest from active quest list 35 | * @param id The Quest ID 36 | */ 37 | void stopQuest(int id); 38 | 39 | /** 40 | * Removes the quest from active and finished quest list 41 | * @param id The Quest ID 42 | */ 43 | void removeQuest(int id); 44 | 45 | boolean hasReadDialog(int id); 46 | 47 | /** 48 | * @param name Name of the person talking in the dialog 49 | */ 50 | void showDialog(int id, String name); 51 | 52 | /** 53 | * @param id Removes the given id from the read dialogs list 54 | */ 55 | void removeDialog(int id); 56 | 57 | /** 58 | * @param id Adds the given id to the read dialogs 59 | */ 60 | void addDialog(int id); 61 | /** 62 | * @param faction The faction id 63 | * @param points The points to increase. Use negative values to decrease 64 | */ 65 | void addFactionPoints(int faction, int points); 66 | 67 | /** 68 | * @param faction The faction id 69 | * @return points 70 | */ 71 | int getFactionPoints(int faction); 72 | 73 | void message(String message); 74 | 75 | int getGamemode(); 76 | 77 | void setGamemode(int mode); 78 | 79 | /** 80 | * Use getInventory().count instead 81 | * @deprecated 82 | */ 83 | int inventoryItemCount(IItemStack item); 84 | 85 | /** 86 | * Use getInventory().count instead 87 | * @deprecated 88 | */ 89 | int inventoryItemCount(String id); 90 | 91 | /** 92 | * @return Returns a IItemStack array size 36 93 | */ 94 | IContainer getInventory(); 95 | 96 | /** 97 | * @return Returns the itemstack the player is currently holding in a container gui 98 | */ 99 | IItemStack getInventoryHeldItem(); 100 | 101 | /** 102 | * @param item The Item type to be removed 103 | * @param amount How many will be removed 104 | * @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given 105 | */ 106 | boolean removeItem(IItemStack item, int amount); 107 | 108 | /** 109 | * @param id The items name 110 | * @param amount How many will be removed 111 | * @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given or item doesnt exist 112 | */ 113 | boolean removeItem(String id, int amount); 114 | 115 | void removeAllItems(IItemStack item); 116 | 117 | /** 118 | * @param items Item to be added or dropped if inventory is full 119 | */ 120 | void giveOrDropItems(IItemStack[] items); 121 | 122 | /** 123 | * @param item Item to be added 124 | * @return Returns whether or not it gave the item succesfully 125 | */ 126 | boolean giveItem(IItemStack item); 127 | 128 | 129 | /** 130 | * @param id The items name 131 | * @param amount The amount of the item to be added 132 | * @return Returns whether or not it gave the item succesfully 133 | */ 134 | boolean giveItem(String id, int amount); 135 | 136 | 137 | /** 138 | * Same as the /spawnpoint command 139 | * @param x The x position 140 | * @param y The y position 141 | * @param z The z position 142 | */ 143 | void setSpawnpoint(int x, int y, int z); 144 | 145 | void resetSpawnpoint(); 146 | 147 | /** 148 | * @param achievement The achievement id. For a complete list see here 114 | */ 115 | public void setModel(String model); 116 | 117 | public String getModel(); 118 | 119 | /** 120 | * @param state 0:Normal, 1:None, 2:Solid 121 | */ 122 | public void setHitboxState(byte state); 123 | 124 | /** 125 | * @return 0:Normal, 1:None, 2:Solid 126 | */ 127 | public byte getHitboxState(); 128 | 129 | } 130 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCInventory.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | import noppes.npcs.api.item.IItemStack; 4 | 5 | public interface INPCInventory { 6 | 7 | public IItemStack getRightHand(); 8 | 9 | public void setRightHand(IItemStack item); 10 | 11 | public IItemStack getLeftHand(); 12 | 13 | public void setLeftHand(IItemStack item); 14 | 15 | public IItemStack getProjectile(); 16 | 17 | public void setProjectile(IItemStack item); 18 | 19 | 20 | /** 21 | * @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots 22 | * @return Returns the armor item 23 | */ 24 | public IItemStack getArmor(int slot); 25 | 26 | 27 | /** 28 | * @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots 29 | * @param item 30 | */ 31 | public void setArmor(int slot, IItemStack item); 32 | 33 | /** 34 | * @param slot 0-8 35 | * @param item 36 | * @param chance 1-100 37 | */ 38 | public void setDropItem(int slot, IItemStack item, float chance); 39 | 40 | /** 41 | * @param slot 0-8 42 | */ 43 | public IItemStack getDropItem(int slot); 44 | 45 | public int getExpMin(); 46 | 47 | public int getExpMax(); 48 | 49 | /** 50 | * @return Returns a value between expMin and expMax 51 | */ 52 | public int getExpRNG(); 53 | 54 | /** 55 | * Sets the random exp dropped when the npc dies 56 | */ 57 | public void setExp(int min, int max); 58 | 59 | public IItemStack[] getItemsRNG(); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCJob.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | public interface INPCJob { 4 | 5 | public int getType(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCMelee.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | public interface INPCMelee { 4 | 5 | public int getStrength(); 6 | 7 | public void setStrength(int strength); 8 | 9 | public int getDelay(); 10 | 11 | public void setDelay(int speed); 12 | 13 | public int getRange(); 14 | 15 | public void setRange(int range); 16 | 17 | public int getKnockback(); 18 | 19 | public void setKnockback(int knockback); 20 | 21 | public int getEffectType(); 22 | 23 | public int getEffectTime(); 24 | 25 | public int getEffectStrength(); 26 | 27 | public void setEffect(int type, int strength, int time); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCRanged.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | public interface INPCRanged { 4 | 5 | int getStrength(); 6 | 7 | void setStrength(int strength); 8 | 9 | /** 10 | * @return Speed of the projectile shot 11 | */ 12 | int getSpeed(); 13 | 14 | /** 15 | * @param speed Speed of the projectile shot (default:10) 16 | */ 17 | void setSpeed(int speed); 18 | 19 | /** 20 | * Burst is the ammount shot at a time. E.g. a burst of 5 burst delay of 2 and a normal delay of 20, 21 | * will shoot 5 projectiles with a delay of 2 ticks every 20 ticks. 22 | */ 23 | int getBurst(); 24 | 25 | void setBurst(int count); 26 | 27 | int getBurstDelay(); 28 | 29 | void setBurstDelay(int delay); 30 | 31 | int getKnockback(); 32 | 33 | void setKnockback(int punch); 34 | 35 | int getSize(); 36 | 37 | void setSize(int size); 38 | 39 | boolean getRender3D(); 40 | 41 | void setRender3D(boolean render3d); 42 | 43 | boolean getSpins(); 44 | 45 | void setSpins(boolean spins); 46 | 47 | boolean getSticks(); 48 | 49 | void setSticks(boolean sticks); 50 | 51 | boolean getHasGravity(); 52 | 53 | void setHasGravity(boolean hasGravity); 54 | 55 | boolean getAccelerate(); 56 | 57 | void setAccelerate(boolean accelerate); 58 | 59 | int getExplodeSize(); 60 | 61 | void setExplodeSize(int size); 62 | 63 | /** 64 | * @see noppes.npcs.api.constants.PotionEffectType 65 | */ 66 | int getEffectType(); 67 | 68 | int getEffectTime(); 69 | 70 | int getEffectStrength(); 71 | 72 | void setEffect(int type, int strength, int time); 73 | 74 | boolean getGlows(); 75 | 76 | void setGlows(boolean glows); 77 | 78 | /** 79 | * see http://minecraft.gamepedia.com/Particles 80 | */ 81 | String getParticle(); 82 | 83 | /** 84 | * see http://minecraft.gamepedia.com/Particles 85 | */ 86 | void setParticle(String type); 87 | 88 | /** 89 | * @param type 0:Fire 90 | */ 91 | String getSound(int type); 92 | 93 | /** 94 | * @param type 0:Fire, 1:Hit, 2:Ground 95 | */ 96 | void setSound(int type, String sound); 97 | 98 | int getShotCount(); 99 | 100 | void setShotCount(int count); 101 | 102 | boolean getHasAimAnimation(); 103 | 104 | void setHasAimAnimation(boolean aim); 105 | 106 | int getAccuracy(); 107 | 108 | void setAccuracy(int accuracy); 109 | 110 | int getRange(); 111 | 112 | void setRange(int range); 113 | 114 | int getDelayMin(); 115 | 116 | int getDelayMax(); 117 | 118 | /** 119 | * @return Returns a value between delayMin and delayMax 120 | */ 121 | int getDelayRNG(); 122 | 123 | void setDelay(int min, int max); 124 | 125 | int getFireType(); 126 | 127 | void setFireType(int type); 128 | 129 | } 130 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCRole.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | public interface INPCRole { 4 | 5 | public int getType(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/INPCStats.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | public interface INPCStats { 4 | 5 | public int getMaxHealth(); 6 | 7 | public void setMaxHealth(int maxHealth); 8 | 9 | /** 10 | * @param type 0:Melee, 1:Ranged, 2:Explosion, 3:Knockback 11 | * @return Returns value between 0 and 2. 0 being no resistance so increased damage and 2 being fully resistant. Normal is 1 12 | */ 13 | public float getResistance(int type); 14 | 15 | public void setResistance(int type, float value); 16 | 17 | /** 18 | * @return Returns the combat health regen per second 19 | */ 20 | public int getCombatRegen(); 21 | 22 | /** 23 | * @param regen The combat health regen per second 24 | */ 25 | public void setCombatRegen(int regen); 26 | 27 | /** 28 | * @return Returns the health regen per second when not in combat 29 | */ 30 | public int getHealthRegen(); 31 | 32 | /** 33 | * @param regen The health regen per second when not in combat 34 | */ 35 | public void setHealthRegen(int regen); 36 | 37 | public INPCMelee getMelee(); 38 | 39 | public INPCRanged getRanged(); 40 | 41 | /** 42 | * @param type 0:Potion, 1:Falldamage, 2:Sunburning, 3:Fire, 4:Drowning, 5:Cobweb 43 | */ 44 | public boolean getImmune(int type); 45 | 46 | /** 47 | * @param type 0:Potion, 1:Falldamage, 2:Sunburning, 3:Fire, 4:Drowning, 5:Cobweb 48 | */ 49 | public void setImmune(int type, boolean bo); 50 | 51 | /** 52 | * (0=Normal, 1=Undead, 2=Arthropod) Only used for damage calculations with enchants 53 | */ 54 | public void setCreatureType(int type); 55 | 56 | /** 57 | * (0=Normal, 1=Undead, 2=Arthropod) Only used for damage calculations with enchants 58 | */ 59 | public int getCreatureType(); 60 | 61 | /** 62 | * @return 0:Yes, 1:Day, 2:Night, 3:No, 4:Naturally 63 | */ 64 | public int getRespawnType(); 65 | 66 | /** 67 | * @param type 0:Yes, 1:Day, 2:Night, 3:No, 4:Naturally 68 | */ 69 | public void setRespawnType(int type); 70 | 71 | public int getRespawnTime(); 72 | 73 | public void setRespawnTime(int seconds); 74 | 75 | public boolean getHideDeadBody(); 76 | 77 | public void setHideDeadBody(boolean hide); 78 | 79 | public int getAggroRange(); 80 | 81 | public void setAggroRange(int range); 82 | 83 | } 84 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/IPixelmonPlayerData.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | /** 4 | * Returns objects from the Pixelmon API see https://reforged.gg/docs/ 5 | */ 6 | public interface IPixelmonPlayerData { 7 | 8 | /** 9 | * Returns PartyStorage 10 | */ 11 | public Object getParty(); 12 | 13 | /** 14 | * Returns PCStorage 15 | */ 16 | public Object getPC(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/IPlayerMail.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data; 2 | 3 | import noppes.npcs.api.handler.data.IQuest; 4 | import noppes.npcs.api.item.IItemStack; 5 | 6 | public interface IPlayerMail { 7 | 8 | String getSender(); 9 | 10 | void setSender(String sender); 11 | 12 | String getSubject(); 13 | 14 | void setSubject(String subject); 15 | 16 | String getText(); 17 | 18 | void setText(String text); 19 | 20 | IQuest getQuest(); 21 | 22 | void setQuest(int id); 23 | 24 | IItemStack getItem(int slot); 25 | 26 | void setItem(int slot, IItemStack item); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobBard.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | public interface IJobBard { 4 | 5 | public String getSong(); 6 | 7 | public void setSong(String song); 8 | 9 | boolean getLooping(); 10 | 11 | void setLooping(boolean bo); 12 | 13 | boolean getIsBackground(); 14 | 15 | void setIsBackground(boolean bo); 16 | 17 | int getMinRange(); 18 | 19 | void setMinRange(int range); 20 | 21 | int getMaxRange(); 22 | 23 | void setMaxRange(int range); 24 | 25 | boolean getHasMaxRange(); 26 | 27 | void setHasMaxRange(boolean bo); 28 | } 29 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobBuilder.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | public interface IJobBuilder { 4 | 5 | public boolean isBuilding(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobFarmer.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | public interface IJobFarmer { 4 | 5 | public boolean isPlucking(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobFollower.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.ICustomNpc; 4 | import noppes.npcs.api.entity.data.INPCJob; 5 | 6 | public interface IJobFollower extends INPCJob{ 7 | 8 | public String getFollowing(); 9 | 10 | public void setFollowing(String name); 11 | 12 | public boolean isFollowing(); 13 | 14 | public ICustomNpc getFollowingNpc(); 15 | } 16 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobPuppet.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.ICustomNpc; 4 | import noppes.npcs.api.entity.data.INPCJob; 5 | import noppes.npcs.api.entity.data.role.IJobPuppet.IJobPuppetPart; 6 | import noppes.npcs.api.event.NpcEvent; 7 | 8 | public interface IJobPuppet extends INPCJob{ 9 | 10 | public boolean getIsAnimated(); 11 | 12 | public void setIsAnimated(boolean bo); 13 | 14 | /** 15 | * @return (0-7) 16 | */ 17 | public int getAnimationSpeed(); 18 | 19 | /** 20 | * @param speed (0-7) 21 | */ 22 | public void setAnimationSpeed(int speed); 23 | 24 | /** 25 | * Part 6-11 are for animation 26 | * @param part 0:head, 1:left arm, 2:right arm, 3:body, 4:left leg, 5:right leg, 6:head2, 7:left arm2, 8:right arm2, 9:body2, 10:left leg2, 11:right leg2 27 | * @return returns the part 28 | */ 29 | public IJobPuppetPart getPart(int part); 30 | 31 | public static interface IJobPuppetPart{ 32 | 33 | public int getRotationX(); 34 | 35 | public int getRotationY(); 36 | 37 | public int getRotationZ(); 38 | 39 | public void setRotation(int x, int y, int z); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IJobSpawner.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.IEntityLiving; 4 | 5 | public interface IJobSpawner { 6 | 7 | /** 8 | * Npc needs to be attacking something or be set to Despawn Spawns On Target Lost: No, otherwise it will despawn right away 9 | * @param i The entity going to be spawned (0-5) 10 | * @return Returns spawned entity 11 | */ 12 | public IEntityLiving spawnEntity(int i); 13 | 14 | public void removeAllSpawned(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IRoleDialog.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | public interface IRoleDialog { 4 | 5 | public String getDialog(); 6 | 7 | public void setDialog(String text); 8 | 9 | public String getOption(int option); 10 | 11 | /** 12 | * @param option The dialog option (1-6) 13 | */ 14 | public void setOption(int option, String text); 15 | 16 | public String getOptionDialog(int option); 17 | 18 | /** 19 | * @param option The dialog option (1-6) 20 | */ 21 | public void setOptionDialog(int option, String text); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IRoleFollower.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.IPlayer; 4 | import noppes.npcs.api.entity.data.INPCRole; 5 | 6 | public interface IRoleFollower extends INPCRole{ 7 | 8 | public int getDays(); 9 | 10 | public void addDays(int days); 11 | 12 | public boolean getInfinite(); 13 | 14 | public void setInfinite(boolean infinite); 15 | 16 | public boolean getGuiDisabled(); 17 | 18 | public void setGuiDisabled(boolean disabled); 19 | 20 | public IPlayer getFollowing(); 21 | 22 | public void setFollowing(IPlayer player); 23 | 24 | public boolean isFollowing(); 25 | 26 | public void reset(); 27 | 28 | public void setRefuseSoulstone(boolean refuse); 29 | 30 | public boolean getRefuseSoulstone(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IRoleTrader.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.data.INPCRole; 4 | import noppes.npcs.api.item.IItemStack; 5 | 6 | public interface IRoleTrader extends INPCRole{ 7 | 8 | /** 9 | * @param slot Slot number 0-17 10 | */ 11 | public IItemStack getSold(int slot); 12 | 13 | /** 14 | * @param slot Slot number 0-17 15 | */ 16 | public IItemStack getCurrency1(int slot); 17 | 18 | /** 19 | * @param slot Slot number 0-17 20 | */ 21 | public IItemStack getCurrency2(int slot); 22 | 23 | /** 24 | * @param slot Slot number 0-17 25 | */ 26 | public void set(int slot, IItemStack currency, IItemStack currency2, IItemStack sold); 27 | 28 | /** 29 | * @param slot Slot number 0-17 30 | */ 31 | public void remove(int slot); 32 | 33 | public void setMarket(String name); 34 | 35 | public String getMarket(); 36 | } 37 | -------------------------------------------------------------------------------- /noppes/npcs/api/entity/data/role/IRoleTransporter.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.entity.data.role; 2 | 3 | import noppes.npcs.api.entity.data.INPCRole; 4 | 5 | public interface IRoleTransporter extends INPCRole { 6 | 7 | public ITransportLocation getLocation(); 8 | 9 | public static interface ITransportLocation{ 10 | 11 | public int getId(); 12 | 13 | public String getDimension(); 14 | 15 | public int getX(); 16 | 17 | public int getY(); 18 | 19 | public int getZ(); 20 | 21 | public String getName(); 22 | 23 | /** 24 | * Returns the unlock type 25 | * @return 0:discover, 1:from start, 2:from start 26 | */ 27 | public int getType(); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/BlockEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.entity.player.Player; 5 | import net.minecraftforge.eventbus.api.Cancelable; 6 | import noppes.npcs.api.IPos; 7 | import noppes.npcs.api.NpcAPI; 8 | import noppes.npcs.api.block.IBlock; 9 | import noppes.npcs.api.constants.SideType; 10 | import noppes.npcs.api.entity.IEntity; 11 | import noppes.npcs.api.entity.IPlayer; 12 | 13 | public class BlockEvent extends CustomNPCsEvent { 14 | public IBlock block; 15 | public BlockEvent(IBlock block){ 16 | this.block = block; 17 | } 18 | 19 | /** 20 | * fallenUpon 21 | */ 22 | @Cancelable 23 | public static class EntityFallenUponEvent extends BlockEvent{ 24 | public final IEntity entity; 25 | public float distanceFallen; 26 | public EntityFallenUponEvent(IBlock block, Entity entity, float distance){ 27 | super(block); 28 | this.distanceFallen = distance; 29 | this.entity = NpcAPI.Instance().getIEntity(entity); 30 | } 31 | } 32 | 33 | /** 34 | * interact 35 | */ 36 | @Cancelable 37 | public static class InteractEvent extends BlockEvent{ 38 | public final IPlayer player; 39 | 40 | public final float hitX, hitY, hitZ; 41 | 42 | /** 43 | * @see SideType 44 | */ 45 | public final int side; 46 | 47 | public InteractEvent(IBlock block, Player player, int side, float hitX, float hitY, float hitZ) { 48 | super(block); 49 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 50 | 51 | this.hitX = hitX; 52 | this.hitY = hitY; 53 | this.hitZ = hitZ; 54 | this.side = side; 55 | } 56 | 57 | } 58 | 59 | /** 60 | * redstone 61 | */ 62 | public static class RedstoneEvent extends BlockEvent{ 63 | public final int prevPower, power; 64 | public RedstoneEvent(IBlock block, int prevPower, int power) { 65 | super(block); 66 | this.power = power; 67 | this.prevPower = prevPower; 68 | } 69 | } 70 | 71 | /** 72 | * doorToggle 73 | */ 74 | @Cancelable 75 | public static class DoorToggleEvent extends BlockEvent{ 76 | public DoorToggleEvent(IBlock block) { 77 | super(block); 78 | } 79 | } 80 | 81 | /** 82 | * broken 83 | */ 84 | public static class BreakEvent extends BlockEvent{ 85 | public BreakEvent(IBlock block) { 86 | super(block); 87 | } 88 | } 89 | 90 | /** 91 | * exploded 92 | */ 93 | @Cancelable 94 | public static class ExplodedEvent extends BlockEvent{ 95 | public ExplodedEvent(IBlock block) { 96 | super(block); 97 | } 98 | } 99 | 100 | /** 101 | * rainFilled 102 | */ 103 | public static class RainFillEvent extends BlockEvent{ 104 | public RainFillEvent(IBlock block) { 105 | super(block); 106 | } 107 | } 108 | 109 | /** 110 | * neighborChanged 111 | */ 112 | public static class NeighborChangedEvent extends BlockEvent{ 113 | public final IPos changedPos; 114 | public NeighborChangedEvent(IBlock block, IPos changedPos) { 115 | super(block); 116 | this.changedPos = changedPos; 117 | } 118 | } 119 | 120 | /** 121 | * init 122 | */ 123 | public static class InitEvent extends BlockEvent{ 124 | public InitEvent(IBlock block) { 125 | super(block); 126 | } 127 | } 128 | 129 | /** 130 | * tick 131 | */ 132 | public static class UpdateEvent extends BlockEvent{ 133 | public UpdateEvent(IBlock block) { 134 | super(block); 135 | } 136 | } 137 | 138 | /** 139 | * clicked 140 | */ 141 | public static class ClickedEvent extends BlockEvent{ 142 | public final IPlayer player; 143 | public ClickedEvent(IBlock block, Player player) { 144 | super(block); 145 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 146 | } 147 | } 148 | 149 | /** 150 | * harvested 151 | */ 152 | @Cancelable 153 | public static class HarvestedEvent extends BlockEvent{ 154 | public final IPlayer player; 155 | public HarvestedEvent(IBlock block, Player player) { 156 | super(block); 157 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 158 | } 159 | } 160 | 161 | /** 162 | * collide 163 | */ 164 | public static class CollidedEvent extends BlockEvent{ 165 | public final IEntity entity; 166 | public CollidedEvent(IBlock block, Entity entity) { 167 | super(block); 168 | this.entity = NpcAPI.Instance().getIEntity(entity); 169 | } 170 | } 171 | 172 | /** 173 | * timer 174 | */ 175 | public static class TimerEvent extends BlockEvent{ 176 | public final int id; 177 | 178 | public TimerEvent(IBlock block, int id) { 179 | super(block); 180 | this.id = id; 181 | } 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/CustomGuiEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraftforge.eventbus.api.Cancelable; 4 | import noppes.npcs.api.entity.IPlayer; 5 | import noppes.npcs.api.gui.IButton; 6 | import noppes.npcs.api.gui.ICustomGui; 7 | import noppes.npcs.api.gui.IItemSlot; 8 | import noppes.npcs.api.gui.IScroll; 9 | import noppes.npcs.api.item.IItemStack; 10 | 11 | public class CustomGuiEvent extends CustomNPCsEvent { 12 | 13 | 14 | public final IPlayer player; 15 | public final ICustomGui gui; 16 | 17 | public CustomGuiEvent(IPlayer player, ICustomGui gui) { 18 | this.player = player; 19 | this.gui = gui; 20 | } 21 | 22 | /** 23 | * customGuiClosed 24 | */ 25 | public static class CloseEvent extends CustomGuiEvent { 26 | 27 | public CloseEvent(IPlayer player, ICustomGui gui) { 28 | super(player,gui); 29 | } 30 | 31 | } 32 | 33 | /** 34 | * customGuiButton 35 | */ 36 | public static class ButtonEvent extends CustomGuiEvent { 37 | public final int buttonId; 38 | public final IButton button; 39 | 40 | public ButtonEvent(IPlayer player, ICustomGui gui, IButton button) { 41 | super(player,gui); 42 | this.button = button; 43 | this.buttonId = button.getID(); 44 | } 45 | 46 | } 47 | 48 | /** 49 | * customGuiSlot 50 | */ 51 | public static class SlotEvent extends CustomGuiEvent { 52 | public final int slotId; 53 | public final IItemStack stack; 54 | public final IItemSlot slot; 55 | 56 | public SlotEvent(IPlayer player, ICustomGui gui, IItemSlot slot) { 57 | super(player,gui); 58 | this.slotId = slot.getID(); 59 | this.stack = slot.getStack(); 60 | this.slot = slot; 61 | } 62 | 63 | } 64 | 65 | /** 66 | * customGuiSlotClicked 67 | */ 68 | @Cancelable 69 | public static class SlotClickEvent extends SlotEvent { 70 | public final int dragType; 71 | public final String clickType; 72 | 73 | public SlotClickEvent(IPlayer player, ICustomGui gui, IItemSlot slot, int dragType, String clickType) { 74 | super(player, gui, slot); 75 | this.dragType = dragType; 76 | this.clickType = clickType; 77 | } 78 | } 79 | 80 | /** 81 | * customGuiScroll 82 | */ 83 | public static class ScrollEvent extends CustomGuiEvent { 84 | public final int scrollId; 85 | public final String[] selection; 86 | public final boolean doubleClick; 87 | public final int scrollIndex; 88 | public final IScroll scroll; 89 | 90 | public ScrollEvent(IPlayer player, ICustomGui gui, IScroll scroll, int scrollIndex, String[] selection, boolean doubleClick) { 91 | super(player,gui); 92 | this.scroll = scroll; 93 | this.scrollId = scroll.getID(); 94 | this.selection = selection; 95 | this.doubleClick = doubleClick; 96 | this.scrollIndex = scrollIndex; 97 | } 98 | 99 | } 100 | 101 | public static class ResizedEvent extends CustomGuiEvent { 102 | public final int oldWidth; 103 | public final int oldHeight; 104 | 105 | public ResizedEvent(IPlayer player, ICustomGui gui, int oldWidth, int oldHeight) { 106 | super(player, gui); 107 | this.oldWidth = oldWidth; 108 | this.oldHeight = oldHeight; 109 | } 110 | } 111 | 112 | public static class OpenedEvent extends CustomGuiEvent { 113 | 114 | public OpenedEvent(IPlayer player, ICustomGui gui) { 115 | super(player, gui); 116 | } 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/CustomNPCsEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraftforge.eventbus.api.Event; 4 | import net.minecraftforge.eventbus.api.Event; 5 | import noppes.npcs.api.NpcAPI; 6 | 7 | public class CustomNPCsEvent extends Event { 8 | public final NpcAPI API = NpcAPI.Instance(); 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/DialogEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraft.world.entity.player.Player; 4 | import net.minecraftforge.eventbus.api.Cancelable; 5 | import noppes.npcs.api.NpcAPI; 6 | import noppes.npcs.api.entity.ICustomNpc; 7 | import noppes.npcs.api.entity.IPlayer; 8 | import noppes.npcs.api.handler.data.IDialog; 9 | import noppes.npcs.api.handler.data.IDialogOption; 10 | 11 | public class DialogEvent extends NpcEvent { 12 | public final IDialog dialog; 13 | public final IPlayer player; 14 | 15 | public DialogEvent(ICustomNpc npc, Player player, IDialog dialog) { 16 | super(npc); 17 | this.dialog = dialog; 18 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 19 | } 20 | 21 | /** 22 | * dialog 23 | */ 24 | @Cancelable 25 | public static class OpenEvent extends DialogEvent { 26 | public OpenEvent(ICustomNpc npc, Player player, IDialog dialog) { 27 | super(npc, player, dialog); 28 | } 29 | 30 | } 31 | 32 | /** 33 | * dialogClose 34 | */ 35 | public static class CloseEvent extends DialogEvent { 36 | public CloseEvent(ICustomNpc npc, Player player, IDialog dialog) { 37 | super(npc, player, dialog); 38 | } 39 | 40 | } 41 | 42 | /** 43 | * dialogOption 44 | */ 45 | @Cancelable 46 | public static class OptionEvent extends DialogEvent { 47 | public final IDialogOption option; 48 | public OptionEvent(ICustomNpc npc, Player player, IDialog dialog, IDialogOption option) { 49 | super(npc, player, dialog); 50 | this.option = option; 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/ForgeEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraftforge.eventbus.api.Cancelable; 4 | import net.minecraftforge.eventbus.api.Event; 5 | import noppes.npcs.api.IWorld; 6 | import noppes.npcs.api.entity.IEntity; 7 | 8 | /** 9 | * Called for most Forge events. For the events I use the forges name and make the first letter lowercase.
10 | * Eg:
11 | * - EntityEvent.EntityJoinLevelEvent becomes entityEventEntityJoinLevelEvent
12 | * - PlayerEvent.StartTracking becomes playerEventStartTracking
13 | * - etc
14 | * 15 | * Note that these events can change anytime and that I have no control over these. Use at own risk 16 | * 17 | */ 18 | @Cancelable 19 | public class ForgeEvent extends CustomNPCsEvent { 20 | public final Event event; 21 | public ForgeEvent(Event event) { 22 | this.event = event; 23 | } 24 | 25 | @Override 26 | public boolean isCancelable() { 27 | return event.isCancelable(); 28 | } 29 | @Override 30 | public boolean isCanceled() { 31 | return event.isCanceled(); 32 | } 33 | @Override 34 | public void setCanceled(boolean cancel) { 35 | event.setCanceled(cancel); 36 | } 37 | 38 | /** 39 | * init
40 | * The init event has no forge event 41 | */ 42 | public static class InitEvent extends ForgeEvent { 43 | public InitEvent() { 44 | super(new Event()); 45 | } 46 | } 47 | 48 | /** 49 | * This event is used for every forge event which extends EntityEvent
50 | * EventyEvent
51 | * LivingEvent
52 | * PlayerEvent 53 | */ 54 | @Cancelable 55 | public static class EntityEvent extends ForgeEvent{ 56 | public final IEntity entity; 57 | 58 | public EntityEvent(net.minecraftforge.event.entity.EntityEvent event, IEntity entity) { 59 | super(event); 60 | this.entity = entity; 61 | } 62 | 63 | } 64 | 65 | /** 66 | * This event is used for every forge event which extends LevelEvent
67 | * LevelEvent 68 | */ 69 | @Cancelable 70 | public static class LevelEvent extends ForgeEvent{ 71 | public final IWorld world; 72 | 73 | public LevelEvent(net.minecraftforge.event.level.LevelEvent event, IWorld world) { 74 | super(event); 75 | this.world = world; 76 | } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/HandlerEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import noppes.npcs.api.handler.IFactionHandler; 4 | import noppes.npcs.api.handler.IRecipeHandler; 5 | 6 | public class HandlerEvent { 7 | 8 | public static class RecipesLoadedEvent extends CustomNPCsEvent{ 9 | public final IRecipeHandler handler; 10 | 11 | public RecipesLoadedEvent(IRecipeHandler handler) { 12 | this.handler = handler; 13 | } 14 | } 15 | 16 | public static class FactionsLoadedEvent extends CustomNPCsEvent{ 17 | public final IFactionHandler handler; 18 | 19 | public FactionsLoadedEvent(IFactionHandler handler) { 20 | this.handler = handler; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/ItemEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraftforge.eventbus.api.Cancelable; 4 | import noppes.npcs.api.IDamageSource; 5 | import noppes.npcs.api.entity.IEntity; 6 | import noppes.npcs.api.entity.IEntityItem; 7 | import noppes.npcs.api.entity.IPlayer; 8 | import noppes.npcs.api.item.IItemScripted; 9 | 10 | public class ItemEvent extends CustomNPCsEvent { 11 | public IItemScripted item; 12 | 13 | public ItemEvent(IItemScripted item) { 14 | this.item = item; 15 | } 16 | 17 | /** 18 | * init 19 | */ 20 | public static class InitEvent extends ItemEvent { 21 | public InitEvent(IItemScripted item) { 22 | super(item); 23 | } 24 | } 25 | 26 | /** 27 | * tick
28 | * When the item is in an inventory this will be called every 10 ticks (0.5 seconds) 29 | */ 30 | public static class UpdateEvent extends ItemEvent { 31 | public IPlayer player; 32 | public UpdateEvent(IItemScripted item, IPlayer player) { 33 | super(item); 34 | this.player = player; 35 | } 36 | } 37 | 38 | /** 39 | * spawn 40 | */ 41 | @Cancelable 42 | public static class SpawnEvent extends ItemEvent { 43 | public IEntityItem entity; 44 | public SpawnEvent(IItemScripted item, IEntityItem entity) { 45 | super(item); 46 | this.entity = entity; 47 | } 48 | } 49 | 50 | /** 51 | * toss
52 | * When Cancelled it prevents the item from spawning in the level, the item still disappears from the inventory 53 | */ 54 | @Cancelable 55 | public static class TossedEvent extends ItemEvent { 56 | public IEntityItem entity; 57 | public IPlayer player; 58 | public TossedEvent(IItemScripted item, IPlayer player, IEntityItem entity) { 59 | super(item); 60 | this.entity = entity; 61 | this.player = player; 62 | } 63 | } 64 | 65 | /** 66 | * pickedUp
67 | * When Cancelled it prevents the item from spawning in the level, the item still disappears from the inventory 68 | */ 69 | public static class PickedUpEvent extends ItemEvent { 70 | public IEntityItem entity; 71 | public IPlayer player; 72 | public PickedUpEvent(IItemScripted item, IPlayer player, IEntityItem entity) { 73 | super(item); 74 | this.entity = entity; 75 | this.player = player; 76 | } 77 | } 78 | 79 | /** 80 | * interact
81 | * Will trigger if you have an item and right click into the air Or right 82 | * click a block Or right click an entity 83 | */ 84 | @Cancelable 85 | public static class InteractEvent extends ItemEvent { 86 | /** 87 | * 0:air, 1:entity, 2:block 88 | */ 89 | public final int type; 90 | public final Object target; 91 | public IPlayer player; 92 | 93 | public InteractEvent(IItemScripted item, IPlayer player, int type, Object target) { 94 | super(item); 95 | this.type = type; 96 | this.target = target; 97 | this.player = player; 98 | } 99 | } 100 | 101 | /** 102 | * attack
103 | * Will trigger if you have an item and left click into the air or left 104 | * click a block or left click an entity 105 | */ 106 | @Cancelable 107 | public static class AttackEvent extends ItemEvent { 108 | /** 109 | * 0:air, 1:entity, 2:block 110 | */ 111 | public final int type; 112 | 113 | public final Object target; 114 | 115 | public IPlayer player; 116 | 117 | /** 118 | * The attack event for entities also has the damageSource 119 | */ 120 | public final IDamageSource damageSource; 121 | 122 | public AttackEvent(IItemScripted item, IPlayer player, int type, Object target) { 123 | super(item); 124 | this.type = type; 125 | this.target = target; 126 | this.player = player; 127 | this.damageSource = null; 128 | } 129 | 130 | public AttackEvent(IItemScripted item, IPlayer player, IEntity target, IDamageSource damageSource) { 131 | super(item); 132 | this.type = 1; 133 | this.target = target; 134 | this.player = player; 135 | this.damageSource = damageSource; 136 | } 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/NpcEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.world.entity.Entity; 7 | import net.minecraft.world.entity.LivingEntity; 8 | import net.minecraft.world.entity.player.Player; 9 | import net.minecraft.world.damagesource.DamageSource; 10 | import net.minecraftforge.eventbus.api.Cancelable; 11 | import noppes.npcs.api.IDamageSource; 12 | import noppes.npcs.api.NpcAPI; 13 | import noppes.npcs.api.entity.ICustomNpc; 14 | import noppes.npcs.api.entity.IEntity; 15 | import noppes.npcs.api.entity.IEntityLiving; 16 | import noppes.npcs.api.entity.IProjectile; 17 | import noppes.npcs.api.entity.data.ILine; 18 | import noppes.npcs.api.item.IItemStack; 19 | import noppes.npcs.api.entity.IPlayer; 20 | 21 | public class NpcEvent extends CustomNPCsEvent{ 22 | public final ICustomNpc npc; 23 | public NpcEvent(ICustomNpc npc) { 24 | this.npc = npc; 25 | } 26 | 27 | /** 28 | * init 29 | */ 30 | public static class InitEvent extends NpcEvent{ 31 | public InitEvent(ICustomNpc npc) { 32 | super(npc); 33 | } 34 | } 35 | 36 | /** 37 | * tick 38 | */ 39 | public static class UpdateEvent extends NpcEvent{ 40 | public UpdateEvent(ICustomNpc npc) { 41 | super(npc); 42 | } 43 | } 44 | 45 | /** 46 | * target 47 | */ 48 | @Cancelable 49 | public static class TargetEvent extends NpcEvent{ 50 | public IEntityLiving entity; 51 | public TargetEvent(ICustomNpc npc, LivingEntity entity) { 52 | super(npc); 53 | this.entity = (IEntityLiving) NpcAPI.Instance().getIEntity(entity); 54 | } 55 | } 56 | 57 | /** 58 | * targetLost 59 | */ 60 | @Cancelable 61 | public static class TargetLostEvent extends NpcEvent{ 62 | /** 63 | * The previous target 64 | */ 65 | public final IEntityLiving entity; 66 | public TargetLostEvent(ICustomNpc npc, LivingEntity entity) { 67 | super(npc); 68 | this.entity = (IEntityLiving) NpcAPI.Instance().getIEntity(entity); 69 | } 70 | } 71 | 72 | /** 73 | * interact 74 | */ 75 | @Cancelable 76 | public static class InteractEvent extends NpcEvent{ 77 | public final IPlayer player; 78 | public InteractEvent(ICustomNpc npc, Player player) { 79 | super(npc); 80 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 81 | } 82 | } 83 | 84 | /** 85 | * died 86 | */ 87 | public static class DiedEvent extends NpcEvent{ 88 | public final IDamageSource damageSource; 89 | 90 | public final String type; 91 | public final IEntity source; 92 | 93 | public IItemStack[] droppedItems; 94 | public int expDropped; 95 | public ILine line; 96 | public DiedEvent(ICustomNpc npc, DamageSource damagesource, Entity entity) { 97 | super(npc); 98 | this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource); 99 | type = damagesource.msgId; 100 | this.source = NpcAPI.Instance().getIEntity(entity); 101 | } 102 | } 103 | 104 | /** 105 | * kill 106 | */ 107 | public static class KilledEntityEvent extends NpcEvent{ 108 | public final IEntityLiving entity; 109 | public KilledEntityEvent(ICustomNpc npc, LivingEntity entity) { 110 | super(npc); 111 | this.entity = (IEntityLiving) NpcAPI.Instance().getIEntity(entity); 112 | } 113 | } 114 | 115 | /** 116 | * meleeAttack 117 | */ 118 | @Cancelable 119 | public static class MeleeAttackEvent extends NpcEvent{ 120 | public final IEntityLiving target; 121 | public float damage; 122 | 123 | public MeleeAttackEvent(ICustomNpc npc, LivingEntity target, float damage) { 124 | super(npc); 125 | this.target = (IEntityLiving) NpcAPI.Instance().getIEntity(target); 126 | this.damage = damage; 127 | } 128 | } 129 | 130 | /** 131 | * rangedAttack 132 | */ 133 | public static class RangedLaunchedEvent extends NpcEvent{ 134 | public final IEntityLiving target; 135 | public float damage; 136 | public List projectiles = new ArrayList(); 137 | 138 | public RangedLaunchedEvent(ICustomNpc npc, LivingEntity target, float damage) { 139 | super(npc); 140 | this.target = (IEntityLiving) NpcAPI.Instance().getIEntity(target); 141 | this.damage = damage; 142 | } 143 | } 144 | 145 | /** 146 | * damaged 147 | */ 148 | @Cancelable 149 | public static class DamagedEvent extends NpcEvent{ 150 | public final IDamageSource damageSource; 151 | public final IEntity source; 152 | public float damage; 153 | public boolean clearTarget = false; 154 | 155 | public DamagedEvent(ICustomNpc npc, Entity source, float damage, DamageSource damagesource) { 156 | super(npc); 157 | this.source = (IEntity) NpcAPI.Instance().getIEntity(source); 158 | this.damage = damage; 159 | this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource); 160 | } 161 | } 162 | 163 | /** 164 | * collide 165 | */ 166 | public static class CollideEvent extends NpcEvent{ 167 | public final IEntity entity; 168 | 169 | public CollideEvent(ICustomNpc npc, Entity entity) { 170 | super(npc); 171 | this.entity = (IEntity) NpcAPI.Instance().getIEntity(entity); 172 | } 173 | } 174 | 175 | /** 176 | * timer 177 | */ 178 | public static class TimerEvent extends NpcEvent{ 179 | public final int id; 180 | 181 | public TimerEvent(ICustomNpc npc, int id) { 182 | super(npc); 183 | this.id = id; 184 | } 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/PlayerEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.damagesource.DamageSource; 6 | import net.minecraftforge.eventbus.api.Cancelable; 7 | import noppes.npcs.api.IContainer; 8 | import noppes.npcs.api.IDamageSource; 9 | import noppes.npcs.api.NpcAPI; 10 | import noppes.npcs.api.block.IBlock; 11 | import noppes.npcs.api.entity.IEntity; 12 | import noppes.npcs.api.entity.IEntityLiving; 13 | import noppes.npcs.api.entity.IPlayer; 14 | import noppes.npcs.api.handler.data.IFaction; 15 | import noppes.npcs.api.item.IItemStack; 16 | 17 | public class PlayerEvent extends CustomNPCsEvent { 18 | public final IPlayer player; 19 | 20 | public PlayerEvent(IPlayer player) { 21 | this.player = player; 22 | } 23 | 24 | /** 25 | * init 26 | */ 27 | public static class InitEvent extends PlayerEvent { 28 | public InitEvent(IPlayer player) { 29 | super(player); 30 | } 31 | } 32 | 33 | /** 34 | * tick 35 | */ 36 | public static class UpdateEvent extends PlayerEvent { 37 | public UpdateEvent(IPlayer player) { 38 | super(player); 39 | } 40 | } 41 | 42 | /** 43 | * interact
44 | * Will trigger if you have an item and right click into the air Or right 45 | * click a block Or right click an entity 46 | */ 47 | @Cancelable 48 | public static class InteractEvent extends PlayerEvent { 49 | /** 50 | * 0:air, 1:entity, 2:block 51 | */ 52 | public final int type; 53 | 54 | public final Object target; 55 | 56 | public InteractEvent(IPlayer player, int type, Object target) { 57 | super(player); 58 | this.type = type; 59 | this.target = target; 60 | } 61 | } 62 | 63 | /** 64 | * attack
65 | * Will trigger if you have an item and left click into the air or left 66 | * click a block or left click an entity 67 | */ 68 | @Cancelable 69 | public static class AttackEvent extends PlayerEvent { 70 | /** 71 | * 0:air, 1:entity, 2:block 72 | */ 73 | public final int type; 74 | 75 | public final Object target; 76 | 77 | 78 | /** 79 | * The attack event for entities also has the damageSource 80 | */ 81 | public final IDamageSource damageSource; 82 | 83 | public AttackEvent(IPlayer player, int type, Object target) { 84 | super(player); 85 | this.type = type; 86 | this.target = target; 87 | this.damageSource = null; 88 | } 89 | 90 | public AttackEvent(IPlayer player, IEntity target, IDamageSource damageSource) { 91 | super(player); 92 | this.type = 1; 93 | this.target = target; 94 | this.damageSource = damageSource; 95 | } 96 | } 97 | 98 | /** 99 | * broken 100 | */ 101 | @Cancelable 102 | public static class BreakEvent extends PlayerEvent { 103 | public final IBlock block; 104 | /** 105 | * Experience that drops if the block is broken 106 | */ 107 | public int exp; 108 | 109 | public BreakEvent(IPlayer player, IBlock block, int exp) { 110 | super(player); 111 | this.block = block; 112 | this.exp = exp; 113 | } 114 | } 115 | 116 | /** 117 | * toss 118 | */ 119 | @Cancelable 120 | public static class TossEvent extends PlayerEvent { 121 | public final IItemStack item; 122 | 123 | public TossEvent(IPlayer player, IItemStack item) { 124 | super(player); 125 | this.item = item; 126 | } 127 | } 128 | 129 | /** 130 | * pickedUp 131 | */ 132 | @Cancelable 133 | public static class PickUpEvent extends PlayerEvent { 134 | public final IItemStack item; 135 | 136 | public PickUpEvent(IPlayer player, IItemStack item) { 137 | super(player); 138 | this.item = item; 139 | } 140 | } 141 | 142 | /** 143 | * containerOpen 144 | */ 145 | public static class ContainerOpen extends PlayerEvent { 146 | public final IContainer container; 147 | 148 | public ContainerOpen(IPlayer player, IContainer container) { 149 | super(player); 150 | this.container = container; 151 | } 152 | } 153 | 154 | /** 155 | * containerClosed 156 | */ 157 | public static class ContainerClosed extends PlayerEvent { 158 | public final IContainer container; 159 | 160 | public ContainerClosed(IPlayer player, IContainer container) { 161 | super(player); 162 | this.container = container; 163 | } 164 | } 165 | 166 | /** 167 | * damagedEntity 168 | */ 169 | @Cancelable 170 | public static class DamagedEntityEvent extends PlayerEvent { 171 | public final IDamageSource damageSource; 172 | 173 | public final IEntity target; 174 | public float damage; 175 | 176 | public DamagedEntityEvent(IPlayer player, Entity target, float damage, DamageSource damagesource) { 177 | super(player); 178 | this.target = NpcAPI.Instance().getIEntity(target); 179 | this.damage = damage; 180 | this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource); 181 | } 182 | } 183 | 184 | /** 185 | * rangedLaunched 186 | */ 187 | @Cancelable 188 | public static class RangedLaunchedEvent extends PlayerEvent { 189 | 190 | public RangedLaunchedEvent(IPlayer player) { 191 | super(player); 192 | } 193 | } 194 | 195 | /** 196 | * died 197 | */ 198 | @Cancelable 199 | public static class DiedEvent extends PlayerEvent { 200 | public final IDamageSource damageSource; 201 | 202 | public final String type; 203 | public final IEntity source; 204 | 205 | public DiedEvent(IPlayer player, DamageSource damagesource, Entity entity) { 206 | super(player); 207 | this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource); 208 | type = damagesource.msgId; 209 | this.source = NpcAPI.Instance().getIEntity(entity); 210 | } 211 | } 212 | 213 | /** 214 | * kill 215 | */ 216 | public static class KilledEntityEvent extends PlayerEvent { 217 | public final IEntityLiving entity; 218 | 219 | public KilledEntityEvent(IPlayer player, LivingEntity entity) { 220 | super(player); 221 | this.entity = (IEntityLiving) NpcAPI.Instance().getIEntity(entity); 222 | } 223 | } 224 | 225 | /** 226 | * damaged 227 | */ 228 | @Cancelable 229 | public static class DamagedEvent extends PlayerEvent { 230 | public final IDamageSource damageSource; 231 | public final IEntity source; 232 | public float damage; 233 | public boolean clearTarget = false; 234 | 235 | public DamagedEvent(IPlayer player, Entity source, float damage, DamageSource damagesource) { 236 | super(player); 237 | this.source = (IEntity) NpcAPI.Instance().getIEntity(source); 238 | this.damage = damage; 239 | this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource); 240 | } 241 | } 242 | 243 | /** 244 | * timer 245 | */ 246 | public static class TimerEvent extends PlayerEvent { 247 | public final int id; 248 | 249 | public TimerEvent(IPlayer player, int id) { 250 | super(player); 251 | this.id = id; 252 | } 253 | } 254 | 255 | /** 256 | * login 257 | */ 258 | public static class LoginEvent extends PlayerEvent { 259 | public LoginEvent(IPlayer player) { 260 | super(player); 261 | } 262 | } 263 | 264 | /** 265 | * logout 266 | */ 267 | public static class LogoutEvent extends PlayerEvent { 268 | public LogoutEvent(IPlayer player) { 269 | super(player); 270 | } 271 | } 272 | 273 | /** 274 | * levelUp
275 | * Called when a players level changes 276 | */ 277 | public static class LevelUpEvent extends PlayerEvent { 278 | /** 279 | * The amount the level of the player changed 280 | */ 281 | public final int change; 282 | 283 | public LevelUpEvent(IPlayer player, int change) { 284 | super(player); 285 | this.change = change; 286 | } 287 | } 288 | 289 | /** 290 | * keyPressed
291 | * Called when a player presses a button. 292 | */ 293 | public static class KeyPressedEvent extends PlayerEvent { 294 | /** 295 | * Keyboard buttons, (key codes 296 | */ 297 | public final int key; 298 | public final boolean isCtrlPressed; 299 | public final boolean isAltPressed; 300 | public final boolean isShiftPressed; 301 | /** 302 | * This is the windows or apple key 303 | */ 304 | public final boolean isMetaPressed; 305 | public final String openGui; 306 | 307 | public KeyPressedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, String openGui) { 308 | super(player); 309 | this.key = key; 310 | this.isCtrlPressed = isCtrlPressed; 311 | this.isAltPressed = isAltPressed; 312 | this.isShiftPressed = isShiftPressed; 313 | this.isMetaPressed = isMetaPressed; 314 | this.openGui = openGui; 315 | } 316 | } 317 | 318 | /** 319 | * keyReleased
320 | * Called when a player releases a button. 321 | */ 322 | public static class KeyReleasedEvent extends PlayerEvent { 323 | /** 324 | * Keyboard buttons, (key codes 325 | */ 326 | public final int key; 327 | public final boolean isCtrlPressed; 328 | public final boolean isAltPressed; 329 | public final boolean isShiftPressed; 330 | /** 331 | * This is the windows or apple key 332 | */ 333 | public final boolean isMetaPressed; 334 | public final String openGui; 335 | 336 | public KeyReleasedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, String openGui) { 337 | super(player); 338 | this.key = key; 339 | this.isCtrlPressed = isCtrlPressed; 340 | this.isAltPressed = isAltPressed; 341 | this.isShiftPressed = isShiftPressed; 342 | this.isMetaPressed = isMetaPressed; 343 | this.openGui = openGui; 344 | } 345 | } 346 | 347 | /** 348 | * chat 349 | */ 350 | @Cancelable 351 | public static class ChatEvent extends PlayerEvent { 352 | public String message; 353 | 354 | public ChatEvent(IPlayer player, String message) { 355 | super(player); 356 | this.message = message; 357 | } 358 | } 359 | 360 | /** 361 | * factionUpdate
362 | * Called when a players faction points change 363 | */ 364 | public static class FactionUpdateEvent extends PlayerEvent { 365 | public final IFaction faction; 366 | public int points; 367 | 368 | /** 369 | * true if it's setting the default points to the player 370 | */ 371 | public boolean init; 372 | 373 | public FactionUpdateEvent(IPlayer player, IFaction faction, int points, boolean init) { 374 | super(player); 375 | this.faction = faction; 376 | this.points = points; 377 | this.init = init; 378 | } 379 | 380 | } 381 | 382 | /** 383 | * playSound 384 | */ 385 | public static class PlaySoundEvent extends PlayerEvent { 386 | public final String sound; 387 | public final String category; 388 | public final boolean looping; 389 | 390 | public PlaySoundEvent(IPlayer player, String sound, String category, boolean looping) { 391 | super(player); 392 | this.sound = sound; 393 | this.category = category; 394 | this.looping = looping; 395 | } 396 | } 397 | } 398 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/ProjectileEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import noppes.npcs.api.entity.IProjectile; 4 | 5 | public class ProjectileEvent extends CustomNPCsEvent { 6 | public IProjectile projectile; 7 | 8 | public ProjectileEvent(IProjectile projectile) { 9 | this.projectile = projectile; 10 | } 11 | 12 | /** 13 | * projectileTick 14 | */ 15 | public static class UpdateEvent extends ProjectileEvent { 16 | public UpdateEvent(IProjectile projectile) { 17 | super(projectile); 18 | } 19 | } 20 | 21 | /** 22 | * projectileImpact 23 | */ 24 | public static class ImpactEvent extends ProjectileEvent { 25 | /** 26 | * 0:entity, 1:block 27 | */ 28 | public final int type; 29 | public final Object target; 30 | 31 | public ImpactEvent(IProjectile projectile, int type, Object target) { 32 | super(projectile); 33 | this.type = type; 34 | this.target = target; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/QuestEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraft.world.entity.player.Player; 4 | import net.minecraftforge.eventbus.api.Cancelable; 5 | import noppes.npcs.api.NpcAPI; 6 | import noppes.npcs.api.entity.IPlayer; 7 | import noppes.npcs.api.handler.data.IQuest; 8 | import noppes.npcs.api.item.IItemStack; 9 | 10 | public class QuestEvent extends CustomNPCsEvent { 11 | public final IQuest quest; 12 | public final IPlayer player; 13 | public QuestEvent(IPlayer player, IQuest quest) { 14 | this.quest = quest; 15 | this.player = player; 16 | } 17 | 18 | @Cancelable 19 | public static class QuestStartEvent extends QuestEvent{ 20 | 21 | public QuestStartEvent(IPlayer player, IQuest quest) { 22 | super(player, quest); 23 | } 24 | 25 | } 26 | 27 | public static class QuestCompletedEvent extends QuestEvent{ 28 | 29 | public QuestCompletedEvent(IPlayer player, IQuest quest) { 30 | super(player, quest); 31 | } 32 | 33 | } 34 | 35 | public static class QuestTurnedInEvent extends QuestEvent{ 36 | public int expReward; 37 | public IItemStack[] itemRewards = new IItemStack[0]; 38 | 39 | public QuestTurnedInEvent(IPlayer player, IQuest quest) { 40 | super(player, quest); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/RoleEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import net.minecraft.world.entity.player.Player; 4 | import net.minecraft.world.item.ItemStack; 5 | import net.minecraftforge.eventbus.api.Cancelable; 6 | import noppes.npcs.api.NpcAPI; 7 | import noppes.npcs.api.entity.ICustomNpc; 8 | import noppes.npcs.api.entity.IPlayer; 9 | import noppes.npcs.api.entity.data.IPlayerMail; 10 | import noppes.npcs.api.entity.data.role.IRoleTransporter.ITransportLocation; 11 | import noppes.npcs.api.item.IItemStack; 12 | 13 | public class RoleEvent extends CustomNPCsEvent { 14 | public final ICustomNpc npc; 15 | public final IPlayer player; 16 | 17 | public RoleEvent(Player player, ICustomNpc npc){ 18 | this.npc = npc; 19 | this.player = (IPlayer) NpcAPI.Instance().getIEntity(player); 20 | } 21 | 22 | @Cancelable 23 | public static class TransporterUseEvent extends RoleEvent{ 24 | public final ITransportLocation location; 25 | public TransporterUseEvent(Player player, ICustomNpc npc, ITransportLocation location) { 26 | super(player, npc); 27 | this.location = location; 28 | } 29 | } 30 | 31 | @Cancelable 32 | public static class TransporterUnlockedEvent extends RoleEvent{ 33 | 34 | public TransporterUnlockedEvent(Player player, ICustomNpc npc) { 35 | super(player, npc); 36 | } 37 | } 38 | 39 | @Cancelable 40 | public static class MailmanEvent extends RoleEvent{ 41 | public final IPlayerMail mail; 42 | 43 | public MailmanEvent(Player player, ICustomNpc npc, IPlayerMail mail) { 44 | super(player, npc); 45 | this.mail = mail; 46 | } 47 | } 48 | 49 | @Cancelable 50 | public static class FollowerHireEvent extends RoleEvent{ 51 | public int days; 52 | 53 | public FollowerHireEvent(Player player, ICustomNpc npc, int days) { 54 | super(player, npc); 55 | this.days = days; 56 | } 57 | } 58 | 59 | public static class FollowerFinishedEvent extends RoleEvent{ 60 | 61 | public FollowerFinishedEvent(Player player, ICustomNpc npc) { 62 | super(player, npc); 63 | } 64 | } 65 | 66 | @Cancelable 67 | public static class TraderEvent extends RoleEvent{ 68 | public IItemStack sold; 69 | public IItemStack currency1; 70 | public IItemStack currency2; 71 | 72 | public TraderEvent(Player player, ICustomNpc npc, IItemStack sold, IItemStack currency1, IItemStack currency2) { 73 | super(player, npc); 74 | this.currency1 = currency1.copy(); 75 | this.currency2 = currency2.copy(); 76 | this.sold = sold.copy(); 77 | } 78 | } 79 | 80 | public static class TradeFailedEvent extends RoleEvent{ 81 | public final IItemStack sold; 82 | public final IItemStack currency1; 83 | public final IItemStack currency2; 84 | public IItemStack receiving; 85 | 86 | public TradeFailedEvent(Player player, ICustomNpc npc, IItemStack sold, IItemStack currency1, IItemStack currency2) { 87 | super(player, npc); 88 | this.currency1 = currency1.copy(); 89 | this.currency2 = currency2.copy(); 90 | this.sold = sold.copy(); 91 | } 92 | } 93 | 94 | public static class BankUnlockedEvent extends RoleEvent{ 95 | public final int slot; 96 | 97 | public BankUnlockedEvent(Player player, ICustomNpc npc, int slot) { 98 | super(player, npc); 99 | this.slot = slot; 100 | } 101 | } 102 | 103 | public static class BankUpgradedEvent extends RoleEvent{ 104 | public final int slot; 105 | 106 | public BankUpgradedEvent(Player player, ICustomNpc npc, int slot) { 107 | super(player, npc); 108 | this.slot = slot; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /noppes/npcs/api/event/WorldEvent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.event; 2 | 3 | import noppes.npcs.api.IPos; 4 | import noppes.npcs.api.IWorld; 5 | import noppes.npcs.api.entity.IEntity; 6 | 7 | public class WorldEvent extends CustomNPCsEvent{ 8 | public final IWorld world; 9 | public WorldEvent(IWorld world) { 10 | this.world = world; 11 | } 12 | 13 | public static class ScriptTriggerEvent extends WorldEvent{ 14 | public final Object[] arguments; 15 | /** 16 | * If pos is a Script Block or Door it will call their scripts 17 | */ 18 | public final IPos pos; 19 | /** 20 | * Can be null, if player it will call the player scripts too, if npc it will call the npc scripts 21 | */ 22 | public final IEntity entity; 23 | 24 | public final int id; 25 | 26 | public ScriptTriggerEvent(int id, IWorld level, IPos pos, IEntity entity, Object[] arguments) { 27 | super(level); 28 | this.id = id; 29 | this.arguments = arguments; 30 | this.pos = pos; 31 | this.entity = entity; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/EventWrapper.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function; 2 | 3 | import java.util.Collection; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public class EventWrapper { 8 | private final Map events = new HashMap<>(); 9 | 10 | public void add(String id, T event){ 11 | if(event == null){ 12 | events.remove(id); 13 | } 14 | else{ 15 | events.put(id, event); 16 | } 17 | } 18 | 19 | public boolean has(String id){ 20 | return events.containsKey(id); 21 | } 22 | 23 | public T get(String id){ 24 | return events.get(id); 25 | } 26 | 27 | public T remove(String id){ 28 | return events.remove(id); 29 | } 30 | 31 | public String[] keys(){ 32 | return events.keySet().toArray(String[]::new); 33 | } 34 | 35 | public Collection values(){ 36 | return events.values(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiAction.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | 5 | @FunctionalInterface 6 | public interface GuiAction { 7 | void onAction(ICustomGui gui); 8 | } 9 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiCallback.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | 5 | @FunctionalInterface 6 | public interface GuiCallback { 7 | void onAction(ICustomGui gui, T v); 8 | } 9 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiClosed.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | 5 | @FunctionalInterface 6 | public interface GuiClosed { 7 | /** 8 | * Called when a gui is closed 9 | * @param gui The gui being closed 10 | * @param parent If it was a subgui, this is the parent 11 | */ 12 | void onAction(ICustomGui gui, ICustomGui parent); 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiComponentAction.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.ICustomGuiComponent; 5 | 6 | @FunctionalInterface 7 | public interface GuiComponentAction { 8 | void onAction(ICustomGui gui, T comp); 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiComponentHold.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.ICustomGuiComponent; 5 | 6 | @FunctionalInterface 7 | public interface GuiComponentHold { 8 | void onAction(ICustomGui gui, T comp, long milliSec); 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiComponentState.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.ICustomGuiComponent; 5 | 6 | @FunctionalInterface 7 | public interface GuiComponentState { 8 | boolean onChange(ICustomGui gui, ICustomGuiComponent comp); 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiItemSlotAccepts.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.IItemSlot; 5 | import noppes.npcs.api.item.IItemStack; 6 | 7 | @FunctionalInterface 8 | public interface GuiItemSlotAccepts { 9 | boolean onAccepts(ICustomGui gui, IItemSlot slot, IItemStack itemstack); 10 | } 11 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiItemSlotClicked.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.IItemSlot; 5 | 6 | @FunctionalInterface 7 | public interface GuiItemSlotClicked { 8 | boolean onClick(ICustomGui gui, IItemSlot comp, int dragType, String clickType); 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiItemSlotUpdate.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.IItemSlot; 5 | import noppes.npcs.api.gui.ITextField; 6 | 7 | @FunctionalInterface 8 | public interface GuiItemSlotUpdate { 9 | void onUpdate(ICustomGui gui, IItemSlot slot); 10 | } 11 | -------------------------------------------------------------------------------- /noppes/npcs/api/function/gui/GuiScrollAction.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.function.gui; 2 | 3 | import noppes.npcs.api.gui.ICustomGui; 4 | import noppes.npcs.api.gui.ICustomGuiComponent; 5 | import noppes.npcs.api.gui.ScrollItem; 6 | 7 | @FunctionalInterface 8 | public interface GuiScrollAction { 9 | void onAction(ICustomGui gui, T comp, ScrollItem item); 10 | } 11 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IAssetsSelector.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiComponentAction; 5 | 6 | public interface IAssetsSelector extends ICustomGuiComponent { 7 | 8 | String getSelected(); 9 | IAssetsSelector setSelected(String selected); 10 | 11 | /** 12 | * Default: textures 13 | * @return returns root 14 | */ 15 | String getRoot(); 16 | IAssetsSelector setRoot(String root); 17 | 18 | /** 19 | * Default: png 20 | * @return png, ogg, json, or whatever you want to filter 21 | */ 22 | String getFileType(); 23 | /** 24 | * 25 | * @param type png, ogg, json, or whatever you want to filter 26 | */ 27 | IAssetsSelector setFileType(String type); 28 | 29 | IAssetsSelector setOnChange(String id, GuiComponentAction onChange); 30 | EventWrapper> getOnChangeEvents(); 31 | 32 | /** 33 | * Called when an asset is double-clicked 34 | */ 35 | IAssetsSelector setOnPress(String id, GuiComponentAction onChange); 36 | EventWrapper> getOnPressEvents(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IButton.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiComponentAction; 5 | import noppes.npcs.api.function.gui.GuiComponentHold; 6 | import noppes.npcs.api.item.IItemStack; 7 | 8 | public interface IButton extends ICustomGuiComponent { 9 | 10 | String getLabel(); 11 | IButton setLabel(String label); 12 | IButton setLabelOffset(int width, int height); 13 | int getLabelOffsetX(); 14 | int getLabelOffsetY(); 15 | IButton appendLabel(String label, Object... args); 16 | 17 | ITexturedRect getTextureRect(); 18 | void setTextureRect(ITexturedRect rect); 19 | 20 | /** use ITexturedRect */ 21 | @Deprecated 22 | String getTexture(); 23 | /** use ITexturedRect */ 24 | @Deprecated 25 | boolean hasTexture(); 26 | /** use ITexturedRect */ 27 | @Deprecated 28 | IButton setTexture(String texture); 29 | 30 | /** use ITexturedRect */ 31 | @Deprecated 32 | int getTextureX(); 33 | /** use ITexturedRect */ 34 | @Deprecated 35 | int getTextureY(); 36 | /** use ITexturedRect */ 37 | @Deprecated 38 | IButton setTextureOffset(int textureX, int textureY); 39 | 40 | int getTextureHoverOffset(); 41 | IButton setTextureHoverOffset(int height); 42 | 43 | IItemStack getDisplayItem(); 44 | IButton setDisplayItem(IItemStack item); 45 | 46 | int getColor(); 47 | IButton setColor(int color); 48 | 49 | IButton setOnPress(String id, GuiComponentAction onPress); 50 | EventWrapper> getOnPressEvents(); 51 | 52 | IButton setOnHold(String id, GuiComponentHold onPress); 53 | EventWrapper> getOnHoldEvents(); 54 | } 55 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IButtonList.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface IButtonList extends IButton { 4 | 5 | IButtonList setValues(String... values); 6 | String[] getValues(); 7 | 8 | IButtonList setSelected(int selected); 9 | int getSelected(); 10 | 11 | ITexturedRect getLeftTexture(); 12 | ITexturedRect getRightTexture(); 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IComponentsScrollableWrapper.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface IComponentsScrollableWrapper extends IComponentsWrapper { 4 | 5 | IComponentsScrollableWrapper init(int x, int y, int width, int height); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IComponentsWrapper.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.entity.IEntity; 4 | import noppes.npcs.api.item.IItemStack; 5 | 6 | import java.util.List; 7 | 8 | public interface IComponentsWrapper { 9 | 10 | /** 11 | * Add a regular, Minecraft style button to this GUI. Uses default width and height. 12 | * @param id - Unique ID for identifying this button. 13 | * @param label - String to display on this button. 14 | * @param x - X Position, relative to the Left side of the GUI window. 15 | * @param y - Y Position, relative to the Top of the GUI window. 16 | */ 17 | IButton addButton(int id, String label, int x, int y); 18 | 19 | /** 20 | * Add a regular, Minecraft style button to this GUI, with a defined width and height. 21 | * @param id - Unique ID for identifying this button. 22 | * @param label - String to display on this button. 23 | * @param x - X Position, relative to the Left side of the GUI window. 24 | * @param y - Y Position, relative to the Top of the GUI window. 25 | * @param width - Width of this button. 26 | * @param height - Height of this button. 27 | */ 28 | IButton addButton(int id, String label, int x, int y, int width, int height); 29 | 30 | /** 31 | * Add a button which can cycle through values. 32 | * @param id - Unique ID for identifying this button. 33 | * @param x - X Position, relative to the Left side of the GUI window. 34 | * @param y - Y Position, relative to the Top of the GUI window. 35 | * @param width - Width of this button. 36 | * @param height - Height of this button. 37 | */ 38 | IButtonList addButtonList(int id, int x, int y, int width, int height); 39 | 40 | /** 41 | * Add a button with a custom texture to this GUI. 42 | * Hover Texture is taken from directly beneath the base texture. 43 | * For examples, look at Vanilla Minecraft button textures. 44 | * @param id - Unique ID for identifying this button. 45 | * @param label - String to display on this button. 46 | * @param x - X Position, relative to the Left side of the GUI window. 47 | * @param y - Y Position, relative to the Top of the GUI window. 48 | * @param width - Width of this button and texture. 49 | * @param height - Height of this button and texture. 50 | * @param texture - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png") 51 | */ 52 | IButton addTexturedButton(int id, String label, int x, int y, int width, int height, String texture); 53 | 54 | /** 55 | * Add a button with a custom texture to this GUI, with a texture offset. 56 | * Hover Texture is taken from directly beneath the base texture. 57 | * For examples, look at Vanilla Minecraft button textures. 58 | * @param id - Unique ID for identifying this button. 59 | * @param label - String to display on this button. 60 | * @param x - X Position, relative to the Left side of the GUI window. 61 | * @param y - Y Position, relative to the Top of the GUI window. 62 | * @param width - Width of this button and texture. 63 | * @param height - Height of this button and texture. 64 | * @param texture - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png") 65 | * @param textureX - X offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture. 66 | * @param textureY - Y offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture. 67 | */ 68 | IButton addTexturedButton(int id, String label, int x, int y, int width, int height, String texture, int textureX, int textureY); 69 | 70 | /** 71 | * Add a Label to the GUI. 72 | * @param id - Unique ID for identifying this label. 73 | * @param label - String to display. 74 | * @param x - X Position, relative to the Left side of the GUI window. 75 | * @param y - Y Position, relative to the Top of the GUI window. 76 | * @param width - Width of this label. (Does Not Change the font size.) 77 | * @param height - Height of this label. (Does Not Change the font size.) 78 | */ 79 | ILabel addLabel(int id, String label, int x, int y, int width, int height); 80 | 81 | /** 82 | * Add a Label to the GUI. 83 | * @param id - Unique ID for identifying this label. 84 | * @param label - String to display. 85 | * @param x - X Position, relative to the Left side of the GUI window. 86 | * @param y - Y Position, relative to the Top of the GUI window. 87 | * @param width - Width of this label. (Does Not Change the font size.) 88 | * @param height - Height of this label. (Does Not Change the font size.) 89 | * @param color - Color to be applied; 90 | */ 91 | ILabel addLabel(int id, String label, int x, int y, int width, int height, int color); 92 | 93 | /** 94 | * Add a Text Field input to the GUI, that the player can type into. 95 | * @param id - Unique ID for identifying this label. 96 | * @param x - X Position, relative to the Left side of the GUI window. 97 | * @param y - Y Position, relative to the Top of the GUI window. 98 | * @param width - Width of this Text Field. 99 | * @param height - Height of this Text Field. 100 | */ 101 | ITextField addTextField(int id, int x, int y, int width, int height); 102 | 103 | /** 104 | * Add a Text Field input to the GUI, that the player can type into. 105 | * @param id - Unique ID for identifying this label. 106 | * @param x - X Position, relative to the Left side of the GUI window. 107 | * @param y - Y Position, relative to the Top of the GUI window. 108 | * @param width - Width of this Text Field. 109 | * @param height - Height of this Text Field. 110 | */ 111 | ITextArea addTextArea(int id, int x, int y, int width, int height); 112 | 113 | /** 114 | * Add a Scroll List to the GUI, for the player to select from. 115 | * @param id - Unique ID for identifying this scroll. 116 | * @param x - X Position, relative to the Left side of the GUI window. 117 | * @param y - Y Position, relative to the Top of the GUI window. 118 | * @param width - Width of the Scroll List. 119 | * @param height - Height of the Scroll List. 120 | * @param list - List of String options for the player to choose from. 121 | */ 122 | IScroll addScroll(int id, int x, int y, int width, int height, String[] list); 123 | 124 | /** 125 | * Add a Scroll List to the GUI, for the player to select from. 126 | * @param id - Unique ID for identifying this scroll. 127 | * @param format - String format for display 128 | * @param x - X Position, relative to the Left side of the GUI window. 129 | * @param y - Y Position, relative to the Top of the GUI window. 130 | * @param width - Width of the Scroll List. 131 | * @param height - Height of the Scroll List. 132 | */ 133 | ISlider addSlider(int id, int x, int y, int width, int height, String format); 134 | 135 | /** 136 | * Add an entity display 137 | * @param id - Unique ID for identifying this component. 138 | * @param x - X Position, relative to the Left side of the GUI window. 139 | * @param y - Y Position, relative to the Top of the GUI window. 140 | * @param entity - Entity for display 141 | */ 142 | IEntityDisplay addEntityDisplay(int id, int x, int y, int width, int height, IEntity entity); 143 | 144 | /** 145 | * Add a Scroll List to the GUI, for the player to select from. 146 | * @param id - Unique ID for identifying this component. 147 | * @param x - X Position, relative to the Left side of the GUI window. 148 | * @param y - Y Position, relative to the Top of the GUI window. 149 | * @param width - Width of the component. 150 | * @param height - Height of the component. 151 | */ 152 | IAssetsSelector addAssetsSelector(int id, int x, int y, int width, int height); 153 | 154 | /** 155 | * Add a texture to be drawn within the GUI. 156 | * @param id - Unique ID for identifying this texture. 157 | * @param texture - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png") 158 | * @param x - X Position, relative to the Left side of the GUI window. 159 | * @param y - Y Position, relative to the Top of the GUI window. 160 | * @param width - Width of the texture. 161 | * @param height - Height of the texture. 162 | */ 163 | ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height); 164 | 165 | /** 166 | * Add a texture to be drawn within the GUI. 167 | * @param id - Unique ID for identifying this texture. 168 | * @param texture - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png") 169 | * @param x - X Position, relative to the Left side of the GUI window. 170 | * @param y - Y Position, relative to the Top of the GUI window. 171 | * @param width - Width of the texture. 172 | * @param height - Height of the texture. 173 | * @param textureX - X offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture. 174 | * @param textureY - Y offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture. 175 | */ 176 | ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY); 177 | 178 | List getComponents(); 179 | 180 | /** 181 | * Get a component from this GUI by it's ID. 182 | * @param id - Component ID to match. 183 | * @return First ICustomGuiComponent with a matching ID, otherwise null. 184 | */ 185 | ICustomGuiComponent getComponent(int id); 186 | 187 | 188 | void addComponent(ICustomGuiComponent button); 189 | 190 | /** 191 | * Remove component from this GUI by it's ID. 192 | * @param id - Component ID to match. 193 | */ 194 | void removeComponent(int id); 195 | 196 | List getSlots(); 197 | List getPlayerSlots(); 198 | 199 | @Deprecated 200 | IItemSlot addItemSlot(int x, int y); 201 | @Deprecated 202 | IItemSlot addItemSlot(int x, int y, IItemStack stack); 203 | 204 | /** 205 | * Add an Item Slot to the GUI with an IItemStack already in it. 206 | * CAUTION: Handling Item Storage can be complicated. Once the GUI closes, any items in it will be lost unless you handle storing/saving this information yourself. 207 | * @param id - Id to identify this item slot 208 | * @param x - X Position, relative to the Left side of the GUI window. 209 | * @param y - Y Position, relative to the Top of the GUI window. 210 | * @param stack - IItemStack to be in this slot upon opening the GUI. 211 | */ 212 | IItemSlot addItemSlot(int id, int x, int y, IItemStack stack); 213 | 214 | IItemSlot getItemSlot(int id); 215 | 216 | void removeItemSlot(IItemSlot slot); 217 | 218 | @Deprecated 219 | void showPlayerInventory(int x, int y); 220 | 221 | /** 222 | * Add a display of the Player's Inventory to the GUI. 223 | * A Player's inventory is around 162 Wide, and 58 Tall. Take this into consideration when placing this. 224 | * @param x - X Position of the Top-Left corner, relative to the Left side of the GUI window. 225 | * @param y - Y Position of the Top-Left corner, relative to the Top of the GUI window. 226 | * @param full - Show the full inventory or just the hotbar 227 | */ 228 | IItemSlot[] showPlayerInventory(int x, int y, boolean full); 229 | 230 | /** 231 | * Removes all components 232 | */ 233 | void clear(); 234 | } 235 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ICustomGui.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.entity.IPlayer; 4 | import noppes.npcs.api.function.EventWrapper; 5 | import noppes.npcs.api.function.gui.GuiAction; 6 | import noppes.npcs.api.function.gui.GuiCallback; 7 | import noppes.npcs.api.function.gui.GuiClosed; 8 | import noppes.npcs.api.item.IItemStack; 9 | 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | public interface ICustomGui extends IComponentsWrapper { 14 | 15 | @Deprecated //Use getName() 16 | int getID(); 17 | 18 | UUID getUniqueID(); 19 | 20 | String getName(); 21 | 22 | int getWidth(); 23 | int getHeight(); 24 | void setSize(int width, int height); 25 | 26 | String getBackgroundTexture(); 27 | void setBackgroundTexture(String resourceLocation); 28 | 29 | boolean getDoesPauseGame(); 30 | void setDoesPauseGame(boolean bo); 31 | 32 | boolean getCloseOnEsc(); 33 | void setCloseOnEsc(boolean bo); 34 | /** 35 | * Update the player's CustomGUI with this one. 36 | */ 37 | void update(); 38 | 39 | /** 40 | * 41 | * @return Returns the item the player is currently holding in their cursor 42 | */ 43 | IItemStack getCarriedItem(); 44 | void setCarriedItem(IItemStack stack); 45 | 46 | /** 47 | * Updates a single component of a gui, instead of the whole gui 48 | */ 49 | void update(ICustomGuiComponent component); 50 | 51 | IComponentsScrollableWrapper getScrollingPanel(); 52 | 53 | void openSubGui(ICustomGui gui); 54 | 55 | void open(); 56 | 57 | ICustomGui getSubGui(); 58 | 59 | boolean hasSubGui(); 60 | 61 | boolean isSubGui(); 62 | 63 | ICustomGui closeSubGui(); 64 | 65 | /** 66 | * If this is a subgui it closes the subgui 67 | */ 68 | void close(); 69 | 70 | ICustomGui getParentGui(); 71 | ICustomGui getRootGui(); 72 | ICustomGui getActiveGui(); 73 | 74 | IPlayer getPlayer(); 75 | 76 | ICustomGui showMessage(String message); 77 | ICustomGui showYesNo(String message, GuiCallback callback); 78 | ICustomGui showList(String title, String[] list, String selected, GuiCallback callback); 79 | 80 | ICustomGui setOnClosed(String id, GuiClosed onClosed); 81 | EventWrapper getOnClosedEvents(); 82 | 83 | ICustomGui setCustomAction(String id, GuiAction action); 84 | EventWrapper getCustomActionEvents(); 85 | 86 | ICustomGui setOnResized(String id, GuiAction action); 87 | EventWrapper getOnResizedEvents(); 88 | } 89 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ICustomGuiComponent.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiComponentAction; 5 | import noppes.npcs.api.function.gui.GuiComponentState; 6 | 7 | import java.util.UUID; 8 | 9 | public interface ICustomGuiComponent { 10 | 11 | int getID(); 12 | ICustomGuiComponent setID(int id); 13 | 14 | UUID getUniqueID(); 15 | 16 | int getPosX(); 17 | int getPosY(); 18 | ICustomGuiComponent setPos(int x, int y); 19 | 20 | int getWidth(); 21 | int getHeight(); 22 | ICustomGuiComponent setSize(int width, int height); 23 | 24 | default boolean isInside(double x, double y){ 25 | return x >= getPosX() && x < (getPosX() + getWidth()) && y >= getPosY() && y < (getPosY() + getHeight()); 26 | } 27 | 28 | boolean hasHoverText(); 29 | String[] getHoverText(); 30 | ICustomGuiComponent setHoverText(String text); 31 | ICustomGuiComponent setHoverText(String[] text); 32 | 33 | boolean getEnabled(); 34 | ICustomGuiComponent setEnabled(boolean bo); 35 | ICustomGuiComponent setEnabledCondition(GuiComponentState condition); 36 | 37 | boolean getVisible(); 38 | ICustomGuiComponent setVisible(boolean bo); 39 | ICustomGuiComponent setVisibleCondition(GuiComponentState condition); 40 | 41 | boolean getHovered(); 42 | ICustomGuiComponent setHovered(boolean bo); 43 | 44 | ICustomGuiComponent setOnHover(String id, GuiComponentAction onHover); 45 | EventWrapper> getOnHoverEvents(); 46 | 47 | ICustomGuiComponent setOnHoverExit(String id, GuiComponentAction onHoverExit); 48 | EventWrapper> getOnHoverExitEvents(); 49 | 50 | int getType(); 51 | } 52 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IEntityDisplay.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.IWorld; 4 | import noppes.npcs.api.entity.IEntity; 5 | 6 | public interface IEntityDisplay extends ICustomGuiComponent { 7 | 8 | IEntity getEntity(); 9 | IEntityDisplay setEntity(IEntity entity); 10 | 11 | int getRotation(); 12 | IEntityDisplay setRotation(int rot); 13 | 14 | float getScale(); 15 | IEntityDisplay setScale(float scale); 16 | 17 | boolean getBackground(); 18 | IEntityDisplay setBackground(boolean bo); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IItemSlot.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import net.minecraft.world.inventory.Slot; 4 | import noppes.npcs.api.function.EventWrapper; 5 | import noppes.npcs.api.function.gui.GuiItemSlotAccepts; 6 | import noppes.npcs.api.function.gui.GuiItemSlotClicked; 7 | import noppes.npcs.api.function.gui.GuiItemSlotUpdate; 8 | import noppes.npcs.api.item.IItemStack; 9 | 10 | public interface IItemSlot extends ICustomGuiComponent { 11 | 12 | boolean hasStack(); 13 | IItemStack getStack(); 14 | IItemSlot setStack(IItemStack itemStack); 15 | 16 | int getShownSize(); 17 | IItemSlot setShowSize(int size); 18 | 19 | /** 20 | * This is purely for the visual slot, default is 1 21 | * @return GuiType 0:None, 1:Normal, 2:Sword, 3:Arrow, 4:Shield, 5:Head, 6:Body, 7:Legs, 8:Feet 22 | */ 23 | int getGuiType(); 24 | 25 | /** 26 | * This is purely for the visual slot, default is 1 27 | * @param type GuiType 0:None, 1:Normal, 2:Sword, 3:Arrow, 4:Shield, 5:Head, 6:Body, 7:Legs, 8:Feet 28 | */ 29 | IItemSlot setGuiType(int type); 30 | 31 | boolean getDropOnClose(); 32 | IItemSlot setDropOnClose(boolean drop); 33 | 34 | boolean isPlayerSlot(); 35 | 36 | IItemSlot setOnUpdate(String id, GuiItemSlotUpdate onUpdate); 37 | EventWrapper getOnUpdateEvents(); 38 | 39 | IItemSlot setOnClick(String id, GuiItemSlotClicked onPress); 40 | EventWrapper getOnClickEvents(); 41 | 42 | IItemSlot setOnAccepts(String id, GuiItemSlotAccepts onAccepts); 43 | EventWrapper getOnAcceptsEvents(); 44 | 45 | int getIndex(); 46 | 47 | Slot getMCSlot(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ILabel.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface ILabel extends ICustomGuiComponent { 4 | 5 | String getText(); 6 | ILabel setText(String label); 7 | ILabel append(String label, Object... args); 8 | 9 | int getColor(); 10 | ILabel setColor(int color); 11 | 12 | float getScale(); 13 | ILabel setScale(float scale); 14 | 15 | @Deprecated 16 | boolean getCentered(); 17 | @Deprecated 18 | ILabel setCentered(boolean bo); 19 | 20 | /** 21 | * Where to align the text 22 | * @return 0: left, 1: center, 2: right 23 | */ 24 | int getAlignment(); 25 | 26 | /** 27 | * Where to align the text 28 | * @param type 0: left, 1: center, 2: right 29 | */ 30 | ILabel setAlignment(int type); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/IScroll.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiScrollAction; 5 | 6 | public interface IScroll extends ICustomGuiComponent { 7 | 8 | String[] getList(); 9 | IScroll setList(String[] list); 10 | 11 | ScrollItem[] getItems(); 12 | IScroll setItems(ScrollItem[] items); 13 | ScrollItem[] getSelected(); 14 | 15 | IScroll setSorted(); 16 | 17 | @Deprecated 18 | int getDefaultSelection(); 19 | @Deprecated 20 | IScroll setDefaultSelection(int defaultSelection); 21 | 22 | int[] getSelection(); 23 | IScroll setSelection(int... selection); 24 | String[] getSelectionList(); 25 | IScroll setSelectionList(String... list); 26 | boolean hasSelection(); 27 | 28 | boolean isMultiSelect(); 29 | IScroll setMultiSelect(boolean multiSelect); 30 | 31 | IScroll setOnClick(String id, GuiScrollAction onClick); 32 | EventWrapper> getOnClickEvents(); 33 | IScroll setOnDoubleClick(String id, GuiScrollAction onDoubleClick); 34 | EventWrapper> getOnDoubleClickEvents(); 35 | 36 | boolean getHasSearch(); 37 | IScroll setHasSearch(boolean bo); 38 | 39 | void clear(); 40 | } 41 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ISlider.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiComponentAction; 5 | 6 | public interface ISlider extends ICustomGuiComponent { 7 | 8 | float getValue(); 9 | ISlider setValue(float value); 10 | 11 | String getFormat(); 12 | ISlider setFormat(String format); 13 | 14 | float getMin(); 15 | ISlider setMin(float min); 16 | 17 | float getMax(); 18 | ISlider setMax(float max); 19 | 20 | int getDecimals(); 21 | ISlider setDecimals(int i); 22 | 23 | ISlider setOnChange(String id, GuiComponentAction onChange); 24 | EventWrapper> getOnChangeEvents(); 25 | } 26 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ITextArea.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface ITextArea extends ITextField { 4 | 5 | ITextArea setCodeTheme(boolean bo); 6 | boolean getCodeTheme(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ITextField.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import noppes.npcs.api.function.EventWrapper; 4 | import noppes.npcs.api.function.gui.GuiComponentAction; 5 | 6 | public interface ITextField extends ICustomGuiComponent { 7 | 8 | String getText(); 9 | ITextField setText(String text); 10 | 11 | int getColor(); 12 | ITextField setColor(int color); 13 | 14 | ITextField setOnChange(String id, GuiComponentAction onChange); 15 | EventWrapper> getOnChangeEvents(); 16 | ITextField setOnFocusLost(String id, GuiComponentAction onChange); 17 | EventWrapper> getOnFocusLostEvents(); 18 | 19 | ITextField setFocused(boolean bo); 20 | boolean getFocused(); 21 | 22 | ITextField setHideBackground(boolean bo); 23 | boolean getHideBackground(); 24 | 25 | /** 26 | * @param type 0:string, 1:int, 2:hex, 3:float, 4:long 27 | */ 28 | ITextField setCharacterType(int type); 29 | /** 30 | * @return 0:string, 1:int, 2:hex, 3:float, 4:long 31 | */ 32 | int getCharacterType(); 33 | 34 | /** 35 | * @return Incase CharacterType is 1 or 2 it will convert text to an integer 36 | */ 37 | int getInteger(); 38 | /** 39 | * @param i Incase CharacterType is 1 or 2 set the text as the integer, if its CharacterType 2 it will convert to Hex 40 | */ 41 | ITextField setInteger(int i); 42 | 43 | float getFloat(); 44 | ITextField setFloat(float f); 45 | 46 | long getLong(); 47 | ITextField setLong(long l); 48 | 49 | /** 50 | * Incase CharacterType is 1 or 2, you can set the min and max value 51 | */ 52 | ITextField setMinMax(Number min, Number max); 53 | 54 | void insertText(String text); 55 | } 56 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ITexturedButton.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface ITexturedButton extends IButton { 4 | 5 | String getTexture(); 6 | ITexturedButton setTexture(String texture); 7 | 8 | int getTextureX(); 9 | int getTextureY(); 10 | ITexturedButton setTextureOffset(int textureX, int textureY); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ITexturedRect.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | public interface ITexturedRect extends ICustomGuiComponent { 4 | 5 | String getTexture(); 6 | ITexturedRect setTexture(String texture); 7 | 8 | float getScale(); 9 | ITexturedRect setScale(float scale); 10 | 11 | int getTextureX(); 12 | int getTextureY(); 13 | ITexturedRect setTextureOffset(int offsetX, int offsetY); 14 | 15 | ITexturedRect setRepeatingTexture(int width, int height, int borderSize); 16 | } 17 | -------------------------------------------------------------------------------- /noppes/npcs/api/gui/ScrollItem.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.gui; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.network.chat.Component; 5 | import net.minecraft.network.chat.contents.TranslatableContents; 6 | 7 | public class ScrollItem { 8 | public int index; 9 | public final Component text; 10 | public boolean selected = false; 11 | private Object associated = null; 12 | 13 | protected ScrollItem(Component text){ 14 | this.text = text; 15 | } 16 | 17 | public CompoundTag getNbt() { 18 | CompoundTag comp = new CompoundTag(); 19 | comp.putString("text", Component.Serializer.toJson(text)); 20 | comp.putInt("index", index); 21 | comp.putBoolean("selected", selected); 22 | return comp; 23 | } 24 | 25 | public static ScrollItem create(CompoundTag comp) { 26 | ScrollItem item = new ScrollItem(Component.Serializer.fromJson(comp.getString("text"))); 27 | item.selected = comp.getBoolean("selected"); 28 | item.index = comp.getInt("index"); 29 | return item; 30 | } 31 | 32 | public static ScrollItem create(Component text) { 33 | return new ScrollItem(text); 34 | } 35 | 36 | public static ScrollItem create(String s) { 37 | return create(Component.translatable(s)); 38 | } 39 | 40 | public ScrollItem setIndex(int index){ 41 | this.index = index; 42 | return this; 43 | } 44 | 45 | public ScrollItem setObject(Object ob){ 46 | this.associated = ob; 47 | return this; 48 | } 49 | 50 | public Object getObject(){ 51 | return associated; 52 | } 53 | 54 | public String getString(){ 55 | if(text == Component.EMPTY){ 56 | return ""; 57 | } 58 | if(text.getContents() instanceof TranslatableContents tc){ 59 | return tc.getKey(); 60 | } 61 | return text.getString(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/ICloneHandler.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler; 2 | 3 | import noppes.npcs.api.IWorld; 4 | import noppes.npcs.api.entity.IEntity; 5 | 6 | public interface ICloneHandler { 7 | 8 | public IEntity spawn(double x, double y, double z, int tab, String name, IWorld world); 9 | 10 | public IEntity get(int tab, String name, IWorld world); 11 | 12 | public void set(int tab, String name, IEntity entity); 13 | 14 | public void remove(int tab, String name); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/IDialogHandler.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler; 2 | 3 | import java.util.List; 4 | 5 | import noppes.npcs.api.handler.data.IDialog; 6 | import noppes.npcs.api.handler.data.IDialogCategory; 7 | 8 | public interface IDialogHandler { 9 | 10 | public List categories(); 11 | 12 | public IDialog get(int id); 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/IFactionHandler.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler; 2 | 3 | import java.util.List; 4 | 5 | import noppes.npcs.api.handler.data.IFaction; 6 | 7 | public interface IFactionHandler { 8 | 9 | public List list(); 10 | 11 | public IFaction delete(int id); 12 | 13 | /** 14 | * Example: create("Bandits", 0xFF0000) 15 | */ 16 | public IFaction create(String name, int color); 17 | 18 | public IFaction get(int id); 19 | } 20 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/IQuestHandler.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler; 2 | 3 | import java.util.List; 4 | 5 | import noppes.npcs.api.handler.data.IQuest; 6 | import noppes.npcs.api.handler.data.IQuestCategory; 7 | 8 | public interface IQuestHandler { 9 | 10 | public List categories(); 11 | 12 | public IQuest get(int id); 13 | } 14 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/IRecipeHandler.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.world.item.ItemStack; 6 | import noppes.npcs.api.handler.data.IRecipe; 7 | 8 | public interface IRecipeHandler { 9 | 10 | public List getGlobalList(); 11 | 12 | public List getCarpentryList(); 13 | 14 | public IRecipe addRecipe(String name, boolean global, ItemStack result, Object... objects); 15 | 16 | public IRecipe addRecipe(String name, boolean global, ItemStack result, int width, int height, ItemStack... recipe); 17 | 18 | public IRecipe delete(int id); 19 | } 20 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IAvailability.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import noppes.npcs.api.entity.IPlayer; 4 | 5 | public interface IAvailability { 6 | 7 | public boolean isAvailable(IPlayer player); 8 | 9 | /** 10 | * @return 0:Always, 1:Night, 2:Day 11 | */ 12 | public int getDaytime(); 13 | 14 | /** 15 | * @param type 0:Always, 1:Night, 2:Day 16 | */ 17 | public void setDaytime(int type); 18 | 19 | public int getMinPlayerLevel(); 20 | 21 | public void setMinPlayerLevel(int level); 22 | 23 | /** 24 | * @param i (0-3) 25 | * @return Returns dialog id, -1 if no dialog was set 26 | */ 27 | public int getDialog(int i); 28 | 29 | /** 30 | * @param i (0-3) 31 | * @param id Dialog id 32 | * @param type 0:Always, 1:After, 2:Before 33 | */ 34 | public void setDialog(int i, int id, int type); 35 | 36 | /** 37 | * @param i (0-3) 38 | */ 39 | public void removeDialog(int i); 40 | 41 | /** 42 | * @param i (0-3) 43 | * @return Returns quest id, -1 if no quest was set 44 | */ 45 | public int getQuest(int i); 46 | 47 | /** 48 | * @param i (0-3) 49 | * @param id Quest id 50 | * @param type 0:Always, 1:After, 2:Before, 3:Active, 4:NotActive, 5:Completed 51 | */ 52 | public void setQuest(int i, int id, int type); 53 | 54 | /** 55 | * @param i (0-1) 56 | */ 57 | public void removeQuest(int i); 58 | 59 | /** 60 | * @param i (0-1) 61 | * @param id Faction id 62 | * @param type 0:Always, 1:Is, 2:IsNot 63 | * @param stance 0:Friendly, 1:Neutral, 2:Hostile 64 | */ 65 | public void setFaction(int i, int id, int type, int stance); 66 | 67 | /** 68 | * @param i (0-1) 69 | */ 70 | public void removeFaction(int i); 71 | 72 | /** 73 | * @param i (0-1) 74 | * @param objective Scoreboard Objective 75 | * @param type 0:Smalle, 1:Equals, 2:Bigger 76 | * @param value Scoreboard score value 77 | */ 78 | public void setScoreboard(int i, String objective, int type, int value); 79 | } 80 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IDialog.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import java.util.List; 4 | 5 | public interface IDialog { 6 | 7 | int getId(); 8 | 9 | String getName(); 10 | 11 | void setName(String name); 12 | 13 | String getText(); 14 | 15 | void setText(String text); 16 | 17 | IQuest getQuest(); 18 | 19 | void setQuest(IQuest quest); 20 | 21 | String[] getCommands(); 22 | 23 | void setCommands(String... commands); 24 | 25 | List getOptions(); 26 | 27 | /** 28 | * @param slot (0-5) 29 | * @return 30 | */ 31 | IDialogOption getOption(int slot); 32 | 33 | IAvailability getAvailability(); 34 | 35 | IDialogCategory getCategory(); 36 | 37 | void save(); 38 | } 39 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IDialogCategory.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import java.util.List; 4 | 5 | public interface IDialogCategory { 6 | 7 | public List dialogs(); 8 | 9 | public String getName(); 10 | 11 | void setName(String name); 12 | 13 | public IDialog create(); 14 | } 15 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IDialogOption.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | public interface IDialogOption { 4 | int getSlot(); 5 | 6 | String getName(); 7 | IDialogOption setName(String name); 8 | 9 | String getText(); 10 | IDialogOption setText(String text); 11 | 12 | /** 13 | * 14 | * @return see OptionType 15 | */ 16 | int getType(); 17 | IDialogOption setType(int type); 18 | 19 | String[] getCommands(); 20 | void setCommands(String... commands); 21 | 22 | IDialog getDialog(); 23 | IDialogOption setDialog(IDialog dialog); 24 | 25 | } -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IFaction.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import noppes.npcs.api.entity.ICustomNpc; 4 | import noppes.npcs.api.entity.IPlayer; 5 | 6 | public interface IFaction { 7 | 8 | public int getId(); 9 | 10 | public String getName(); 11 | 12 | public int getDefaultPoints(); 13 | 14 | public void setDefaultPoints(int points); 15 | 16 | public int getColor(); 17 | 18 | /** 19 | * @return Returns -1:Unfriendly, 0:Neutral, 1:Friendly 20 | */ 21 | public int playerStatus(IPlayer player); 22 | 23 | public boolean hostileToNpc(ICustomNpc npc); 24 | 25 | public boolean hostileToFaction(int factionId); 26 | 27 | public int[] getHostileList(); 28 | 29 | public void addHostile(int id); 30 | 31 | public void removeHostile(int id); 32 | 33 | public boolean hasHostile(int id); 34 | 35 | public boolean getIsHidden(); 36 | 37 | public void setIsHidden(boolean bo); 38 | 39 | public boolean getAttackedByMobs(); 40 | 41 | public void setAttackedByMobs(boolean bo); 42 | 43 | public void save(); 44 | } 45 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IQuest.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import noppes.npcs.api.IContainer; 4 | import noppes.npcs.api.constants.QuestType; 5 | import noppes.npcs.api.entity.IPlayer; 6 | import noppes.npcs.api.item.IItemStack; 7 | 8 | public interface IQuest { 9 | int getId(); 10 | 11 | String getName(); 12 | 13 | void setName(String name); 14 | 15 | int getType(); 16 | 17 | void setType(int type); 18 | 19 | String getLogText(); 20 | 21 | void setLogText(String text); 22 | 23 | String getCompleteText(); 24 | 25 | void setCompleteText(String text); 26 | 27 | IQuest getNextQuest(); 28 | 29 | void setNextQuest(IQuest quest); 30 | 31 | IQuestObjective[] getObjectives(IPlayer player); 32 | 33 | IQuestCategory getCategory(); 34 | 35 | IItemStack[] getRewards(); 36 | void setRewards(IItemStack[] items); 37 | 38 | /** 39 | * @return The npcs name where this quest can be completed 40 | */ 41 | String getNpcName(); 42 | 43 | /** 44 | * @param name The npcs name where this quest can be completed 45 | */ 46 | void setNpcName(String name); 47 | 48 | void save(); 49 | 50 | boolean getIsRepeatable(); 51 | 52 | String[] getCommands(); 53 | 54 | void setCommands(String... commands); 55 | } 56 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IQuestCategory.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import java.util.List; 4 | 5 | public interface IQuestCategory { 6 | 7 | public List quests(); 8 | 9 | public String getName(); 10 | 11 | public void setName(String name); 12 | 13 | public IQuest create(); 14 | } 15 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IQuestObjective.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | 6 | 7 | public interface IQuestObjective { 8 | 9 | public int getProgress(); 10 | 11 | /** 12 | * Does not work for Item or Dialog quests 13 | * @param progress Progress of the objective 14 | */ 15 | public void setProgress(int progress); 16 | 17 | public int getMaxProgress(); 18 | 19 | public boolean isCompleted(); 20 | 21 | public String getText(); 22 | 23 | public Component getMCText(); 24 | } 25 | -------------------------------------------------------------------------------- /noppes/npcs/api/handler/data/IRecipe.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.handler.data; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | 5 | 6 | 7 | public interface IRecipe { 8 | 9 | public String getName(); 10 | 11 | 12 | public boolean isGlobal(); 13 | 14 | public void setIsGlobal(boolean bo); 15 | 16 | public boolean getIgnoreNBT(); 17 | 18 | public void setIgnoreNBT(boolean bo); 19 | 20 | public boolean getIgnoreDamage(); 21 | 22 | public void setIgnoreDamage(boolean bo); 23 | 24 | public int getWidth(); 25 | 26 | public int getHeight(); 27 | 28 | public ItemStack getResult(); 29 | 30 | public ItemStack[] getRecipe(); 31 | 32 | /** 33 | * @param bo Whether or not the recipe saves with customnpcs recipes 34 | */ 35 | public void saves(boolean bo); 36 | 37 | public boolean saves(); 38 | 39 | public void save(); 40 | 41 | public void delete(); 42 | } 43 | -------------------------------------------------------------------------------- /noppes/npcs/api/item/IItemArmor.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.item; 2 | 3 | import net.minecraft.world.entity.EquipmentSlot; 4 | 5 | public interface IItemArmor extends IItemStack { 6 | 7 | int getArmorSlot(); 8 | 9 | String getArmorMaterial(); 10 | 11 | EquipmentSlot getSlotType(); 12 | } 13 | -------------------------------------------------------------------------------- /noppes/npcs/api/item/IItemBlock.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.item; 2 | 3 | import noppes.npcs.api.block.IBlock; 4 | 5 | public interface IItemBlock extends IItemStack { 6 | 7 | public String getBlockName(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /noppes/npcs/api/item/IItemBook.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.item; 2 | 3 | public interface IItemBook extends IItemStack{ 4 | 5 | /** 6 | * @return If the item is a book, returns a string array with book pages 7 | */ 8 | public String[] getText(); 9 | 10 | /** 11 | * Set the text for multiple pages 12 | */ 13 | public void setText(String[] pages); 14 | 15 | public String getAuthor(); 16 | 17 | public void setAuthor(String author); 18 | 19 | public String getTitle(); 20 | 21 | public void setTitle(String title); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /noppes/npcs/api/item/IItemScripted.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.item; 2 | 3 | public interface IItemScripted extends IItemStack { 4 | 5 | boolean hasTexture(int damage); 6 | 7 | /** 8 | * @deprecated will be removed in the future 9 | */ 10 | String getTexture(int damage); 11 | 12 | String getTexture(); 13 | 14 | /** 15 | * @deprecated will be removed in the future 16 | */ 17 | void setTexture(int damage, String texture); 18 | 19 | /** 20 | * @param texture Item the scripted item will use as texture 21 | */ 22 | void setTexture(String texture); 23 | 24 | void setMaxStackSize(int size); 25 | 26 | /** 27 | * @return Returns a value between 0 and 1, 0 is an empty durability bar and 1 a full one 28 | */ 29 | double getDurabilityValue(); 30 | 31 | /** 32 | * @param value A value between 0 and 1, 0 is an empty durability bar and 1 a full one 33 | */ 34 | void setDurabilityValue(float value); 35 | 36 | /** 37 | * @return Returns whether the durability is visible or not 38 | */ 39 | boolean getDurabilityShow(); 40 | 41 | /** 42 | * @param bo Set whether the durability is visible 43 | */ 44 | void setDurabilityShow(boolean bo); 45 | 46 | /** 47 | * @return Returns the customly set durability color for the bar. If no custom value is set it will return -1 48 | */ 49 | int getDurabilityColor(); 50 | 51 | /** 52 | * @param color Set a custom color hex value for durability bar. 53 | */ 54 | void setDurabilityColor(int color); 55 | 56 | /** 57 | * @return Returns the color of the item. -1 for no color 58 | */ 59 | int getColor(); 60 | 61 | /** 62 | * @param color Set a custom color hex value for the item tint. -1 to remove the color 63 | */ 64 | void setColor(int color); 65 | } 66 | -------------------------------------------------------------------------------- /noppes/npcs/api/item/IItemStack.java: -------------------------------------------------------------------------------- 1 | package noppes.npcs.api.item; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | import noppes.npcs.api.INbt; 5 | import noppes.npcs.api.entity.IEntityLiving; 6 | import noppes.npcs.api.entity.IMob; 7 | import noppes.npcs.api.entity.data.IData; 8 | 9 | 10 | 11 | public interface IItemStack { 12 | 13 | int getStackSize(); 14 | 15 | /** 16 | * @param size The size of the itemstack. A number between 1 and 64 17 | */ 18 | void setStackSize(int size); 19 | 20 | int getMaxStackSize(); 21 | 22 | boolean isDamageable(); 23 | /** 24 | * @return Returns the damage of this item. Only for items that have durability. 25 | */ 26 | int getDamage(); 27 | 28 | /** 29 | * @param value The value to be set as item damage. Only for items that have durability. 30 | */ 31 | void setDamage(int value); 32 | 33 | int getMaxDamage(); 34 | 35 | double getAttackDamage(); 36 | 37 | void damageItem(int damage, IMob living); 38 | 39 | /** 40 | * @param id The enchantment id 41 | * @param strenght The strenght of the enchantment 42 | */ 43 | void addEnchantment(String id, int strenght); 44 | 45 | boolean isEnchanted(); 46 | 47 | /** 48 | * @param id The enchantment id 49 | */ 50 | boolean hasEnchant(String id); 51 | 52 | /** 53 | * @param id The enchantment id 54 | * @return Returns whether something was removed or not 55 | */ 56 | boolean removeEnchant(String id); 57 | 58 | /** 59 | * @deprecated 60 | * @return Returns whether or not this item is a block 61 | */ 62 | boolean isBlock(); 63 | 64 | boolean isWearable(); 65 | 66 | /** 67 | * @return Return whether or not the item has a custom name 68 | */ 69 | boolean hasCustomName(); 70 | 71 | /** 72 | * @param name The custom name this item will get 73 | */ 74 | void setCustomName(String name); 75 | 76 | /** 77 | * @return Return the ingame displayed name. This is either the item name or the custom name if it has one. 78 | */ 79 | String getDisplayName(); 80 | 81 | /** 82 | * @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name. 83 | */ 84 | String getItemName(); 85 | 86 | /** 87 | * @return The minecraft name for this item 88 | */ 89 | String getName(); 90 | 91 | /** 92 | * @deprecated 93 | * @return Whether this is a writable book item. If it is check IItemBook for more info 94 | */ 95 | boolean isBook(); 96 | 97 | /** 98 | * @return A copy of the ItemStack 99 | */ 100 | IItemStack copy(); 101 | 102 | /** 103 | * No support is given for this method. Dont use if you dont know what you are doing. 104 | * @return Minecraft ItemStack 105 | */ 106 | ItemStack getMCItemStack(); 107 | 108 | /** 109 | * @return Used to get the extra NBT, which is used by enchantments and customname 110 | */ 111 | INbt getNbt(); 112 | 113 | /** 114 | * @return Returns false if the nbt of this itemstack is null or empty 115 | */ 116 | boolean hasNbt(); 117 | 118 | /** 119 | * Removes the nbt from the itemstack 120 | */ 121 | void removeNbt(); 122 | 123 | /** 124 | * @return The entire item as nbt 125 | */ 126 | INbt getItemNbt(); 127 | 128 | /** 129 | * @return Returns true if this itemstack is air or the stacksize is 0 130 | */ 131 | boolean isEmpty(); 132 | 133 | /** 134 | * @return {@link noppes.npcs.api.constants.ItemType} 135 | */ 136 | int getType(); 137 | 138 | String[] getLore(); 139 | 140 | void setLore(String[] lore); 141 | 142 | /** 143 | * @param name Attribute name see (https://minecraft.gamepedia.com/Attribute) 144 | * @param value 145 | * @deprecated Replaced by setAttribute(String name, double value, int slot) 146 | */ 147 | void setAttribute(String name, double value); 148 | 149 | /** 150 | * @param name Attribute name see (https://minecraft.gamepedia.com/Attribute) 151 | * @param value 152 | * @param slot Slot in which the attribute is active -1:ALL, 0:MAINHAND, 1:OFFHAND, 2:FEET, 3:LEGS, 4:CHEST, 5:HEAD 153 | */ 154 | void setAttribute(String name, double value, int slot); 155 | 156 | /** 157 | * @param name Attribute name see (https://minecraft.gamepedia.com/Attribute) 158 | * @return Returns the value of this attribute 159 | */ 160 | double getAttribute(String name); 161 | 162 | /** 163 | * @param name Attribute name see (https://minecraft.gamepedia.com/Attribute) 164 | * @return Whether or not this item has the attribute 165 | */ 166 | boolean hasAttribute(String name); 167 | 168 | /** 169 | * Temp data stores anything but only untill it's reloaded 170 | */ 171 | IData getTempdata(); 172 | 173 | /** 174 | * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved 175 | */ 176 | IData getStoreddata(); 177 | 178 | /** 179 | * @return Returns 0 if the item isnt food and otherwise the amount it restores hunger 180 | */ 181 | int getFoodLevel(); 182 | 183 | @Deprecated 184 | boolean compare(IItemStack item, boolean ignoreNBT); 185 | 186 | boolean compare(IItemStack item, boolean ignoreNBT, boolean ignoreDamage); 187 | boolean compare(ItemStack item, boolean ignoreNBT, boolean ignoreDamage); 188 | 189 | /** 190 | * Splits the itemstack 191 | * @param stackSize Size to reduce stacksize with 192 | * @return returns a new itemstack of stackSize length 193 | */ 194 | IItemStack split(int stackSize); 195 | 196 | /** 197 | * Simulates an entity using this item 198 | * @param entity Entity that clicked, can be null 199 | * @param isMainHand Use as mainhand or offhand 200 | */ 201 | void use(IEntityLiving entity, boolean isMainHand); 202 | 203 | } 204 | --------------------------------------------------------------------------------