mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 19:15:11 +00:00
Double clicking events in the hook list will now paste them into your code. More scripting functions added for NPCs.
This commit is contained in:
1 parent
547f5ab82d
commit
f14bc107d3
5 files changed
+586
-30
No files matched your search
@@ -45,12 +45,12 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListe
|
||||
addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18));
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, Short.MAX_VALUE, 0);
|
||||
getTextField(0).setMinMaxDefault(0, npc.inventory.maxExp, 0);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(0, Short.MAX_VALUE, 0);
|
||||
getTextField(1).setMinMaxDefault(npc.inventory.maxExp, Short.MAX_VALUE, 0);
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 88, guiTop + 88, 80, 20, new String[]{"stats.normal", "inv.auto"}, npc.inventory.lootMode));
|
||||
|
||||
|
||||
@@ -218,9 +218,21 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
this.ySize = 256;
|
||||
}
|
||||
|
||||
public String previousHookClicked = "";
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
//this.handler.getScripts().get(this.activeTab - 1).setType(scroll.getSelected().replace("playerscript.",""));
|
||||
String hook = scroll.getSelected();
|
||||
if(previousHookClicked.equals(hook)){
|
||||
String addString = "";
|
||||
if(!this.getTextField(2).getText().isEmpty())
|
||||
addString += "\n";
|
||||
addString += "function "+hook+"(event) {\n \n}\n";
|
||||
|
||||
this.getTextField(2).setText(this.getTextField(2).getText()+addString);
|
||||
previousHookClicked = "";
|
||||
} else {
|
||||
previousHookClicked = hook;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -230,15 +242,6 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
}*/
|
||||
}
|
||||
|
||||
/*private int getScriptHook(EventScriptContainer eventScriptContainer, List<String> list) {
|
||||
for(String s : list) {
|
||||
if (s.replace("playerscript.", "").equals(eventScriptContainer.type)) {
|
||||
return list.indexOf(s);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
private String getConsoleText() {
|
||||
Map<Long, String> map = this.handler.getConsoleText();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@@ -85,8 +85,9 @@ public class ScriptContainer {
|
||||
public void run(ScriptEngine engine){
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
engine.getContext().setWriter(pw);
|
||||
engine.getContext().setErrorWriter(pw);
|
||||
this.engine.getContext().setWriter(pw);
|
||||
this.engine.getContext().setErrorWriter(pw);
|
||||
|
||||
try {
|
||||
if(compScript == null && engine instanceof Compilable)
|
||||
compScript = ((Compilable)engine).compile(getFullCode());
|
||||
@@ -96,12 +97,13 @@ public class ScriptContainer {
|
||||
}
|
||||
else
|
||||
engine.eval(getFullCode());
|
||||
|
||||
} catch (Exception e) {
|
||||
errored = true;
|
||||
appandConsole(e.getMessage());
|
||||
} catch (Throwable var14) {
|
||||
this.errored = true;
|
||||
var14.printStackTrace(pw);
|
||||
} finally {
|
||||
this.appandConsole(sw.getBuffer().toString().trim());
|
||||
pw.close();
|
||||
}
|
||||
appandConsole(sw.getBuffer().toString().trim());
|
||||
}
|
||||
|
||||
public void run(EnumScriptType type, Event event) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
@@ -215,6 +216,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.setFaction(id);
|
||||
}
|
||||
|
||||
public void setAttackFactions(boolean attackOtherFactions){
|
||||
npc.advanced.attackOtherFactions = attackOtherFactions;
|
||||
}
|
||||
|
||||
public boolean getAttackFactions(){
|
||||
return npc.advanced.attackOtherFactions;
|
||||
}
|
||||
|
||||
public void setDefendFaction(boolean defendFaction){
|
||||
npc.advanced.defendFaction = defendFaction;
|
||||
}
|
||||
|
||||
public boolean getDefendFaction(){
|
||||
return npc.advanced.defendFaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
return EntityType.NPC;
|
||||
@@ -372,6 +389,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.inventory.setProjectile(item.item);
|
||||
npc.script.aiNeedsUpdate = true;
|
||||
}
|
||||
|
||||
public boolean canAimWhileShooting() {
|
||||
return !npc.stats.aimWhileShooting;
|
||||
}
|
||||
|
||||
public void aimWhileShooting(boolean aimWhileShooting) {
|
||||
npc.stats.aimWhileShooting = aimWhileShooting;
|
||||
}
|
||||
|
||||
public String getFireSound() {
|
||||
return npc.stats.fireSound;
|
||||
}
|
||||
|
||||
public void setFireSound(String fireSound) {
|
||||
npc.stats.fireSound = fireSound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots
|
||||
@@ -398,6 +431,91 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to return (0-8)
|
||||
* @return
|
||||
*/
|
||||
public ScriptItemStack getLootItem(int slot) {
|
||||
return new ScriptItemStack(npc.inventory.getStackInSlot(slot+7));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to change
|
||||
* @param item The item the drop list slot will be changed to
|
||||
*/
|
||||
public void setLootItem(int slot, ScriptItemStack item) {
|
||||
npc.inventory.setInventorySlotContents(slot+7, item.item);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to return (0-8)
|
||||
* @return The chance of dropping the item in this slot. Returns 100 if the slot is not found.
|
||||
*/
|
||||
public int getLootChance(int slot) {
|
||||
if(!npc.inventory.dropchance.containsKey(slot))
|
||||
return 100;
|
||||
|
||||
return npc.inventory.dropchance.get(slot);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to change
|
||||
* @param chance The new chance of dropping the item in this slot
|
||||
*/
|
||||
public void setLootChance(int slot, int chance) {
|
||||
if(slot < 0 || slot > 8)
|
||||
return;
|
||||
|
||||
if(chance < 0)
|
||||
chance = 0;
|
||||
if(chance > 100)
|
||||
chance = 100;
|
||||
|
||||
npc.inventory.dropchance.put(slot,chance);
|
||||
}
|
||||
|
||||
public int getLootMode(){
|
||||
return npc.inventory.lootMode;
|
||||
}
|
||||
|
||||
public void setLootMode(int lootMode){
|
||||
if(lootMode < 0 || lootMode > 1)
|
||||
return;
|
||||
npc.inventory.lootMode = lootMode;
|
||||
}
|
||||
|
||||
public void setMinLootXP(int lootXP) {
|
||||
if(lootXP > npc.inventory.maxExp)
|
||||
lootXP = npc.inventory.maxExp;
|
||||
if(lootXP < 0)
|
||||
lootXP = 0;
|
||||
if(lootXP > Short.MAX_VALUE)
|
||||
lootXP = Short.MAX_VALUE;
|
||||
|
||||
npc.inventory.minExp = lootXP;
|
||||
}
|
||||
public void setMaxLootXP(int lootXP) {
|
||||
if(lootXP < npc.inventory.minExp)
|
||||
lootXP = npc.inventory.minExp;
|
||||
if(lootXP < 0)
|
||||
lootXP = 0;
|
||||
if(lootXP > Short.MAX_VALUE)
|
||||
lootXP = Short.MAX_VALUE;
|
||||
|
||||
npc.inventory.maxExp = lootXP;
|
||||
}
|
||||
|
||||
public int getMinLootXP(){
|
||||
return npc.inventory.minExp;
|
||||
}
|
||||
public int getMaxLootXP(){
|
||||
return npc.inventory.maxExp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type The AnimationType
|
||||
@@ -415,7 +533,81 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.ai.animationType = EnumAnimation.LYING;
|
||||
else if(type == AnimationType.HUGGING)
|
||||
npc.ai.animationType = EnumAnimation.HUG;
|
||||
|
||||
}
|
||||
|
||||
public void setTacticalVariant(int variant){
|
||||
if(variant > EnumNavType.values().length-1)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.values()[variant];
|
||||
}
|
||||
|
||||
public int getTacticalVariant(){
|
||||
return npc.ai.tacticalVariant.ordinal();
|
||||
}
|
||||
|
||||
public void setTacticalVariant(String variant){
|
||||
boolean found = false;
|
||||
for(String s : EnumNavType.names()){
|
||||
if(s.equals(variant))
|
||||
found = true;
|
||||
}
|
||||
|
||||
if(!found)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.valueOf(variant);
|
||||
}
|
||||
|
||||
public String getTacticalVariantName(){
|
||||
return npc.ai.tacticalVariant.name();
|
||||
}
|
||||
|
||||
public void setTacticalRadius(int tacticalRadius){
|
||||
if(tacticalRadius < 0)
|
||||
tacticalRadius = 0;
|
||||
|
||||
npc.ai.tacticalRadius = tacticalRadius;
|
||||
}
|
||||
|
||||
public int getTacticalRadius(){
|
||||
return npc.ai.tacticalRadius;
|
||||
}
|
||||
|
||||
public void setIgnoreCobweb(boolean ignore){
|
||||
npc.ai.ignoreCobweb = ignore;
|
||||
}
|
||||
|
||||
public boolean getIgnoreCobweb(){
|
||||
return npc.ai.ignoreCobweb;
|
||||
}
|
||||
|
||||
public void setOnFoundEnemy(int onAttack){
|
||||
if(onAttack < 0 || onAttack > 3)
|
||||
return;
|
||||
npc.ai.onAttack = onAttack;
|
||||
}
|
||||
|
||||
public int onFoundEnemy(){
|
||||
return npc.ai.onAttack;
|
||||
}
|
||||
|
||||
public void setShelterFrom(int shelterFrom){
|
||||
if(shelterFrom < 0 || shelterFrom > 2)
|
||||
return;
|
||||
npc.ai.findShelter = shelterFrom;
|
||||
}
|
||||
|
||||
public int getShelterFrom(){
|
||||
return npc.ai.findShelter;
|
||||
}
|
||||
|
||||
public boolean hasLivingAnimation() {
|
||||
return !npc.display.disableLivingAnimation;
|
||||
}
|
||||
|
||||
public void setLivingAnimation(boolean livingAnimation) {
|
||||
npc.display.disableLivingAnimation = !livingAnimation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,19 +743,47 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.stats.burstCount = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player The player to give the item to
|
||||
* @param item The item given to the player
|
||||
*/
|
||||
public int getRespawnTime() {
|
||||
return npc.stats.respawnTime;
|
||||
}
|
||||
|
||||
public void setRespawnTime(int time) {
|
||||
npc.stats.respawnTime = time;
|
||||
}
|
||||
|
||||
public int getRespawnCycle() {
|
||||
return npc.stats.spawnCycle;
|
||||
}
|
||||
|
||||
public void setRespawnCycle(int cycle) {
|
||||
if(cycle < 0)
|
||||
cycle = 0;
|
||||
if(cycle > 3)
|
||||
cycle = 3;
|
||||
|
||||
npc.stats.spawnCycle = cycle;
|
||||
}
|
||||
|
||||
public boolean getHideKilledBody() {
|
||||
return npc.stats.hideKilledBody;
|
||||
}
|
||||
|
||||
public void hideKilledBody(boolean hide) {
|
||||
npc.stats.hideKilledBody = hide;
|
||||
}
|
||||
|
||||
public boolean naturallyDespawns() {
|
||||
return npc.stats.canDespawn;
|
||||
}
|
||||
|
||||
public void setNaturallyDespawns(boolean canDespawn) {
|
||||
npc.stats.canDespawn = canDespawn;
|
||||
}
|
||||
|
||||
public void giveItem(ScriptPlayer player, ScriptItemStack item){
|
||||
npc.givePlayerItem(player.player, item.item);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On servers the enable-command-block option in the server.properties needs to be set to true
|
||||
* @param command The command to be executed
|
||||
*/
|
||||
|
||||
public void executeCommand(String command){
|
||||
NoppesUtilServer.runCommand(npc, npc.getCommandSenderName(), command, null);
|
||||
}
|
||||
@@ -714,4 +934,44 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
|
||||
npc.ai.movementType = fly;
|
||||
}
|
||||
|
||||
public void setSkinType(byte type) {
|
||||
npc.display.skinType = type;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public byte getSkinType() {
|
||||
return npc.display.skinType;
|
||||
}
|
||||
|
||||
public void setSkinUrl(String url){
|
||||
if(this.npc.display.url.equals(url))
|
||||
return;
|
||||
this.npc.display.url = url;
|
||||
npc.textureLocation = null;
|
||||
npc.display.skinType = 2;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public String getSkinUrl() {
|
||||
return this.npc.display.url;
|
||||
}
|
||||
|
||||
public void setCloakTexture(String cloakTexture) {
|
||||
npc.display.cloakTexture = cloakTexture;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public String getCloakTexture() {
|
||||
return npc.display.cloakTexture;
|
||||
}
|
||||
|
||||
public void setOverlayTexture(String overlayTexture) {
|
||||
npc.display.glowTexture = overlayTexture;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public String getOverlayTexture() {
|
||||
return npc.display.glowTexture;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.scripted.ScriptFaction;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
@@ -127,6 +128,30 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
*/
|
||||
public void setFaction(int id);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param attackOtherFactions True if you want the NPC to attack other factions, false otherwise.
|
||||
*/
|
||||
public void setAttackFactions(boolean attackOtherFactions);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns true if the NPC attacks other factions, false otherwise.
|
||||
*/
|
||||
public boolean getAttackFactions();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param defendFaction True if the NPC should defend faction members, false otherwise.
|
||||
*/
|
||||
public void setDefendFaction(boolean defendFaction);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns true if the NPC should defend faction members, false otherwise.
|
||||
*/
|
||||
public boolean getDefendFaction();
|
||||
|
||||
public int getType();
|
||||
|
||||
public boolean typeOf(int type);
|
||||
@@ -198,6 +223,30 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
*/
|
||||
public void setProjectileItem(ScriptItemStack item);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns true if the NPC can aim while shooting.
|
||||
*/
|
||||
public boolean canAimWhileShooting();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aimWhileShooting Set to true if you want the NPC to aim while shooting, false otherwise.
|
||||
*/
|
||||
public void aimWhileShooting(boolean aimWhileShooting);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The directory of the sound that plays when a projectile is shot
|
||||
*/
|
||||
public String getFireSound();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fireSound The new directory of the sound that plays when a projectile is shot
|
||||
*/
|
||||
public void setFireSound(String fireSound);
|
||||
|
||||
/**
|
||||
* @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots
|
||||
* @return Returns the worn armor in slot
|
||||
@@ -210,11 +259,189 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
*/
|
||||
public void setArmor(int slot, ScriptItemStack item);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to return (0-8)
|
||||
* @return The item in the NPC's drop list slot
|
||||
*/
|
||||
public ScriptItemStack getLootItem(int slot);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to change
|
||||
* @param item The item the drop list slot will be changed to
|
||||
*/
|
||||
public void setLootItem(int slot, ScriptItemStack item);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to return (0-8)
|
||||
* @return The chance of dropping the item in this slot. Returns 100 if the slot is not found.
|
||||
*/
|
||||
public int getLootChance(int slot);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot from the NPC's drop list to change
|
||||
* @param chance The new chance of dropping the item in this slot
|
||||
*/
|
||||
public void setLootChance(int slot, int chance);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
|
||||
*/
|
||||
public int getLootMode();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lootMode The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
|
||||
*/
|
||||
public void setLootMode(int lootMode);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lootXP The new minimum XP gained from killing the NPC. If greater than the max XP, it will be set to it.
|
||||
*/
|
||||
public void setMinLootXP(int lootXP);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lootXP The new maximum XP gained from killing the NPC. If less than the min XP, it will be set to it.
|
||||
*/
|
||||
public void setMaxLootXP(int lootXP);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The minimum XP gained from killing the NPC.
|
||||
*/
|
||||
public int getMinLootXP();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The maximum XP gained from killing the NPC.
|
||||
*/
|
||||
public int getMaxLootXP();
|
||||
|
||||
/**
|
||||
* @param type The AnimationType
|
||||
*/
|
||||
public void setAnimation(int type);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param variant Changes the tactical variant of the NPC.
|
||||
* 0 - Rush
|
||||
* 1 - Dodge
|
||||
* 2 - Surround
|
||||
* 3 - Hit N Run
|
||||
* 4 - Ambush
|
||||
* 5 - Stalk
|
||||
* 6 - None
|
||||
*
|
||||
*/
|
||||
public void setTacticalVariant(int variant);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the tactical variant of the NPC.
|
||||
* 0 - Rush
|
||||
* 1 - Dodge
|
||||
* 2 - Surround
|
||||
* 3 - Hit N Run
|
||||
* 4 - Ambush
|
||||
* 5 - Stalk
|
||||
* 6 - None
|
||||
*
|
||||
*/
|
||||
public int getTacticalVariant();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param variant Sets the NPC's tactical variant by name.
|
||||
*/
|
||||
public void setTacticalVariant(String variant);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the name of the NPc's tactical variant.
|
||||
*/
|
||||
public String getTacticalVariantName();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tacticalRadius Sets the radius in which the tactical variant is affected, if any. Effective for all tactical variants except Rush and None.
|
||||
*/
|
||||
public void setTacticalRadius(int tacticalRadius);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Gets the radius in which the tactical variant is affected, if any. Effective for all tactical variants except Rush and None.
|
||||
*/
|
||||
public int getTacticalRadius();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ignore True if the NPC goes through cobwebs
|
||||
*/
|
||||
public void setIgnoreCobweb(boolean ignore);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return True if the NPC goes through cobwebs
|
||||
*/
|
||||
public boolean getIgnoreCobweb();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Changes what the NPC does when it finds an enemy based on the integer given.
|
||||
* 0 - Retaliate
|
||||
* 1 - Panic
|
||||
* 2 - Retreat
|
||||
* 3 - Nothing
|
||||
*/
|
||||
public void setOnFoundEnemy(int onAttack);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns an integer representing what the NPC does when it finds an enemy.
|
||||
* 0 - Retaliate
|
||||
* 1 - Panic
|
||||
* 2 - Retreat
|
||||
* 3 - Nothing
|
||||
*/
|
||||
public int onFoundEnemy();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param shelterFrom An integer representing what conditions the NPC seeks shelter under.
|
||||
* 0 - Darkenss
|
||||
* 1 - Sunlight
|
||||
* 2 - Disabled
|
||||
*/
|
||||
public void setShelterFrom(int shelterFrom);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns an integer representing what conditions the NPC seeks shelter under.
|
||||
* 0 - Darkenss
|
||||
* 1 - Sunlight
|
||||
* 2 - Disabled
|
||||
*/
|
||||
public int getShelterFrom();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Whether the NPC has a living animation
|
||||
*/
|
||||
public boolean hasLivingAnimation();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param livingAnimation True if you want the NPC to have a living animation, false otherwise
|
||||
*/
|
||||
public void setLivingAnimation(boolean livingAnimation);
|
||||
|
||||
/**
|
||||
* @param type The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible
|
||||
*/
|
||||
@@ -311,6 +538,54 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
*/
|
||||
public void setRangedBurst(int count);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The amount of ticks before this entity respawns
|
||||
*/
|
||||
public int getRespawnTime();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param time The new amount of ticks before this entity respawns
|
||||
*/
|
||||
public void setRespawnTime(int time);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Respawn: 0 - Yes (Always), 1 - Day, 2 - Night, 3 - No (Dies permanently)
|
||||
*/
|
||||
public int getRespawnCycle();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cycle Sets when the NPC respawns. Respawn: 0 - Yes (Always), 1 - Day, 2 - Night, 3 - No (Dies permanently)
|
||||
*/
|
||||
public void setRespawnCycle(int cycle);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Whether the NPC is hidden when it dies
|
||||
*/
|
||||
public boolean getHideKilledBody();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hide True if the NPC is hidden when it dies. False otherwise.
|
||||
*/
|
||||
public void hideKilledBody(boolean hide);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns true if the NPC naturally despawns.
|
||||
*/
|
||||
public boolean naturallyDespawns();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param canDespawn True if the NPC should naturally despawn. False otherwise.
|
||||
*/
|
||||
public void setNaturallyDespawns(boolean canDespawn);
|
||||
|
||||
/**
|
||||
* @param player The player to give the item to
|
||||
* @param item The item given to the player
|
||||
@@ -404,4 +679,20 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
public boolean canFly();
|
||||
|
||||
public void setFly(int fly);
|
||||
|
||||
public void setSkinType(byte type);
|
||||
|
||||
public byte getSkinType();
|
||||
|
||||
public void setSkinUrl(String url);
|
||||
|
||||
public String getSkinUrl();
|
||||
|
||||
public void setCloakTexture(String cloakTexture);
|
||||
|
||||
public String getCloakTexture();
|
||||
|
||||
public void setOverlayTexture(String overlayTexture);
|
||||
|
||||
public String getOverlayTexture();
|
||||
}
|
||||
Reference in new issue
Block a user