mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 08:38:31 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -9,54 +9,54 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptAnimal<T extends EntityAnimal> extends ScriptLiving<T> implements IAnimal {
|
||||
protected T entity;
|
||||
protected T entity;
|
||||
|
||||
public ScriptAnimal(T entity) {
|
||||
super(entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
return EntityType.ANIMAL;
|
||||
}
|
||||
public ScriptAnimal(T entity) {
|
||||
super(entity);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(IItemStack itemStack) {
|
||||
return this.entity.isBreedingItem(itemStack.getMCItemStack());
|
||||
}
|
||||
@Override
|
||||
public int getType() {
|
||||
return EntityType.ANIMAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
public boolean interact(IPlayer player) {
|
||||
return this.entity.interact((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(IItemStack itemStack) {
|
||||
return this.entity.isBreedingItem(itemStack.getMCItemStack());
|
||||
}
|
||||
|
||||
public void setFollowPlayer(IPlayer player) {
|
||||
this.entity.func_146082_f((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
public boolean interact(IPlayer player) {
|
||||
return this.entity.interact((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
|
||||
public IPlayer followingPlayer() {
|
||||
return (IPlayer) NpcAPI.Instance().getIEntity(this.entity.func_146083_cb());
|
||||
}
|
||||
public void setFollowPlayer(IPlayer player) {
|
||||
this.entity.func_146082_f((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
|
||||
public boolean isInLove() {
|
||||
return this.entity.isInLove();
|
||||
}
|
||||
public IPlayer followingPlayer() {
|
||||
return (IPlayer) NpcAPI.Instance().getIEntity(this.entity.func_146083_cb());
|
||||
}
|
||||
|
||||
public void resetInLove() {
|
||||
this.entity.resetInLove();
|
||||
}
|
||||
public boolean isInLove() {
|
||||
return this.entity.isInLove();
|
||||
}
|
||||
|
||||
public boolean canMateWith(IAnimal animal) {
|
||||
return this.entity.canMateWith((EntityAnimal) animal.getMCEntity());
|
||||
}
|
||||
public void resetInLove() {
|
||||
this.entity.resetInLove();
|
||||
}
|
||||
|
||||
public boolean typeOf(int type){
|
||||
return type == EntityType.ANIMAL || super.typeOf(type);
|
||||
}
|
||||
public boolean canMateWith(IAnimal animal) {
|
||||
return this.entity.canMateWith((EntityAnimal) animal.getMCEntity());
|
||||
}
|
||||
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.ANIMAL || super.typeOf(type);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> implements IDBCPlayer {
|
||||
public T player;
|
||||
|
||||
public ScriptDBCPlayer(T player){
|
||||
public ScriptDBCPlayer(T player) {
|
||||
super(player);
|
||||
this.player = player;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
|
||||
throw new CustomNPCsException("Invalid stat name: " + stat + "\nValid stat names are:" +
|
||||
"\nstr, dex, con, wil, mnd, spi\nstrength, dexterity, constitution, willpower, mind, spirit",new Object[0]);
|
||||
"\nstr, dex, con, wil, mnd, spi\nstrength, dexterity, constitution, willpower, mind, spirit", new Object[0]);
|
||||
}
|
||||
|
||||
private double applyOperator(String method, double n1, double n2) {
|
||||
@@ -90,33 +90,39 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
return n1;
|
||||
}
|
||||
|
||||
public void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue){
|
||||
addBonusAttribute(stat,bonusID,operation,attributeValue,true);
|
||||
public void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue) {
|
||||
addBonusAttribute(stat, bonusID, operation, attributeValue, true);
|
||||
}
|
||||
public void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList){
|
||||
bonusAttribute("add",stat,bonusID,operation,attributeValue,endOfTheList);
|
||||
|
||||
public void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList) {
|
||||
bonusAttribute("add", stat, bonusID, operation, attributeValue, endOfTheList);
|
||||
}
|
||||
public void addToBonusAttribute(String stat, String bonusID, String operation, double attributeValue){
|
||||
bonusAttribute("addto",stat,bonusID,operation,attributeValue,true);
|
||||
|
||||
public void addToBonusAttribute(String stat, String bonusID, String operation, double attributeValue) {
|
||||
bonusAttribute("addto", stat, bonusID, operation, attributeValue, true);
|
||||
}
|
||||
public void setBonusAttribute(String stat, String bonusID, String operation, double attributeValue){
|
||||
bonusAttribute("set",stat,bonusID,operation,attributeValue,true);
|
||||
|
||||
public void setBonusAttribute(String stat, String bonusID, String operation, double attributeValue) {
|
||||
bonusAttribute("set", stat, bonusID, operation, attributeValue, true);
|
||||
}
|
||||
public void getBonusAttribute(String stat, String bonusID){
|
||||
bonusAttribute("get",stat,bonusID,"*",1.0,true);
|
||||
|
||||
public void getBonusAttribute(String stat, String bonusID) {
|
||||
bonusAttribute("get", stat, bonusID, "*", 1.0, true);
|
||||
}
|
||||
public void removeBonusAttribute(String stat, String bonusID){
|
||||
bonusAttribute("remove",stat,bonusID,"*",1.0,true);
|
||||
|
||||
public void removeBonusAttribute(String stat, String bonusID) {
|
||||
bonusAttribute("remove", stat, bonusID, "*", 1.0, true);
|
||||
}
|
||||
public void clearBonusAttribute(String stat){
|
||||
bonusAttribute("clear",stat,"","*",1.0,true);
|
||||
|
||||
public void clearBonusAttribute(String stat) {
|
||||
bonusAttribute("clear", stat, "", "*", 1.0, true);
|
||||
}
|
||||
|
||||
public String bonusAttribute(String action, String stat, String bonusID) {
|
||||
String[] actions = new String[]{"get", "remove", "clear"};
|
||||
boolean valid = false;
|
||||
for(String s : actions){
|
||||
if(s.equals(action.toLowerCase())){
|
||||
for (String s : actions) {
|
||||
if (s.equals(action.toLowerCase())) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +130,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
throw new CustomNPCsException("Action can be: get/remove/clear", new Object[0]);
|
||||
}
|
||||
|
||||
return bonusAttribute(action,stat,bonusID,"*",1.0,false);
|
||||
return bonusAttribute(action, stat, bonusID, "*", 1.0, false);
|
||||
}
|
||||
|
||||
public String bonusAttribute(String action, String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList) {
|
||||
@@ -132,8 +138,8 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
String[] operations = new String[]{"+", "-", "*", "/", "%"};
|
||||
|
||||
boolean valid = false;
|
||||
for(String s : actions){
|
||||
if(s.equals(action.toLowerCase())){
|
||||
for (String s : actions) {
|
||||
if (s.equals(action.toLowerCase())) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +147,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
throw new CustomNPCsException("Action can be: add/addTo/set/get/remove/clear", new Object[0]);
|
||||
}
|
||||
|
||||
if(!action.equals("remove") && !action.equals("get") && !action.equals("clear")) {
|
||||
if (!action.equals("remove") && !action.equals("get") && !action.equals("clear")) {
|
||||
valid = false;
|
||||
for (String s : operations) {
|
||||
if (s.equals(operation)) {
|
||||
@@ -174,16 +180,16 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
stat = "spi";
|
||||
break;
|
||||
}
|
||||
if(!(stat.equals("str") || stat.equals("dex") || stat.equals("con") || stat.equals("wil") || stat.equals("mnd") || stat.equals("spi")))
|
||||
if (!(stat.equals("str") || stat.equals("dex") || stat.equals("con") || stat.equals("wil") || stat.equals("mnd") || stat.equals("spi")))
|
||||
throw new CustomNPCsException("Invalid stat name: " + stat + "\nValid stat names are:" +
|
||||
"\nstr, dex, con, wil, mnd, spi\nstrength, dexterity, constitution, willpower, mind, spirit",new Object[0]);
|
||||
"\nstr, dex, con, wil, mnd, spi\nstrength, dexterity, constitution, willpower, mind, spirit", new Object[0]);
|
||||
|
||||
String bonusValueString = operation + attributeValue;
|
||||
String bonus = player.getEntityData().getCompoundTag("PlayerPersisted").getString("jrmcAttrBonus"+stat);
|
||||
String bonus = player.getEntityData().getCompoundTag("PlayerPersisted").getString("jrmcAttrBonus" + stat);
|
||||
String bonuses[] = bonus.split("\\|");
|
||||
String[][] bonusValues = new String[bonuses.length][2];
|
||||
if (bonuses.length > 0 && bonuses[0].length() > 0) {
|
||||
for(int i = 0; i < bonuses.length; ++i) {
|
||||
for (int i = 0; i < bonuses.length; ++i) {
|
||||
String[] bonusValue = bonuses[i].split("\\;");
|
||||
bonusValues[i][0] = bonusValue[0];
|
||||
bonusValues[i][1] = bonusValue[1];
|
||||
@@ -192,7 +198,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
|
||||
switch (action) {
|
||||
case "get":
|
||||
if(player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus"+stat)) {
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus" + stat)) {
|
||||
for (String[] s : bonusValues) {
|
||||
if (s[0].equals(bonusID))
|
||||
return s[1];
|
||||
@@ -200,12 +206,12 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
return "";
|
||||
case "clear":
|
||||
if(player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus"+stat))
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus"+stat, "");
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus" + stat))
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus" + stat, "");
|
||||
break;
|
||||
case "remove":
|
||||
String newBonusString = "";
|
||||
if(player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus"+stat)) {
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcAttrBonus" + stat)) {
|
||||
int num = -1;
|
||||
boolean number;
|
||||
boolean run = false;
|
||||
@@ -218,7 +224,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
number = false;
|
||||
}
|
||||
|
||||
for(int i = 0; i < bonuses.length; ++i) {
|
||||
for (int i = 0; i < bonuses.length; ++i) {
|
||||
bonusValue = bonuses[i].split("\\;");
|
||||
bonusValues[i][0] = bonusValue[0];
|
||||
if (number && i == num || !number && bonusValues[i][0].equals(bonusID)) {
|
||||
@@ -237,7 +243,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus"+stat, startString);
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus" + stat, startString);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -267,7 +273,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
bonus = bonusID + ";" + bonusValueString + "|" + bonus;
|
||||
}
|
||||
}
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus"+stat, bonus);
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus" + stat, bonus);
|
||||
}
|
||||
break;
|
||||
case "set": {
|
||||
@@ -307,7 +313,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus"+stat, startString);
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus" + stat, startString);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -349,7 +355,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus"+stat, startString);
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcAttrBonus" + stat, startString);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -358,80 +364,88 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setRelease(byte release){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcRelease",release);
|
||||
public void setRelease(byte release) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcRelease", release);
|
||||
}
|
||||
public byte getRelease(){
|
||||
|
||||
public byte getRelease() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcRelease");
|
||||
}
|
||||
|
||||
public void setBody(int body){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcBdy",body);
|
||||
public void setBody(int body) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcBdy", body);
|
||||
}
|
||||
public int getBody(){
|
||||
|
||||
public int getBody() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcBdy");
|
||||
}
|
||||
|
||||
public void setHP(int hp){
|
||||
public void setHP(int hp) {
|
||||
setBody(hp);
|
||||
}
|
||||
public int getHP()
|
||||
{
|
||||
|
||||
public int getHP() {
|
||||
return getBody();
|
||||
}
|
||||
|
||||
|
||||
public void setStamina(int stamina){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcStamina",stamina);
|
||||
public void setStamina(int stamina) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcStamina", stamina);
|
||||
}
|
||||
public int getStamina(){
|
||||
|
||||
public int getStamina() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcStamina");
|
||||
}
|
||||
|
||||
public void setKi(int ki){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcEnrgy",ki);
|
||||
public void setKi(int ki) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcEnrgy", ki);
|
||||
}
|
||||
public int getKi(){
|
||||
|
||||
public int getKi() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcEnrgy");
|
||||
}
|
||||
|
||||
public void setTP(int tp){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcTpint",tp);
|
||||
public void setTP(int tp) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcTpint", tp);
|
||||
}
|
||||
public int getTP(){
|
||||
|
||||
public int getTP() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcTpint");
|
||||
}
|
||||
|
||||
public void setGravity(float gravity){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setFloat("jrmcGravForce",gravity);
|
||||
public void setGravity(float gravity) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setFloat("jrmcGravForce", gravity);
|
||||
}
|
||||
public float getGravity(){
|
||||
|
||||
public float getGravity() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getFloat("jrmcGravForce");
|
||||
}
|
||||
|
||||
public boolean isBlocking(){
|
||||
public boolean isBlocking() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
return compound.getCompoundTag("JRMCEP").getInteger("blocking") == 1;
|
||||
}
|
||||
|
||||
public void setHairCode(String hairCode){
|
||||
public void setHairCode(String hairCode) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
compound.getCompoundTag("JRMCEP").setString("haircode",hairCode);
|
||||
compound.getCompoundTag("JRMCEP").setString("haircode", hairCode);
|
||||
}
|
||||
public String getHairCode(){
|
||||
|
||||
public String getHairCode() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
return compound.getCompoundTag("JRMCEP").getString("haircode");
|
||||
}
|
||||
|
||||
public void setExtraCode(String extraCode){
|
||||
public void setExtraCode(String extraCode) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
compound.getCompoundTag("JRMCEP").setString("extracode",extraCode);
|
||||
compound.getCompoundTag("JRMCEP").setString("extracode", extraCode);
|
||||
}
|
||||
public String getExtraCode(){
|
||||
|
||||
public String getExtraCode() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
return compound.getCompoundTag("JRMCEP").getString("extracode");
|
||||
@@ -444,7 +458,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
byte offset = (byte) (vanity ? 10 : 2);
|
||||
|
||||
NBTTagList newList = new NBTTagList();
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
if (offset - list.getCompoundTagAt(i).getByte("Slot") != slot) {
|
||||
newList.appendTag(list.getCompoundTagAt(i));
|
||||
@@ -468,7 +482,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
|
||||
byte offset = (byte) (vanity ? 10 : 2);
|
||||
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
if (offset - list.getCompoundTagAt(i).getByte("Slot") == slot) {
|
||||
return NpcAPI.Instance().getIItemStack(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i)));
|
||||
@@ -478,11 +492,11 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
return null;
|
||||
}
|
||||
|
||||
public IItemStack[] getInventory(){
|
||||
public IItemStack[] getInventory() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag", 10);
|
||||
IItemStack[] itemList = new IItemStack[list.tagCount()];
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
ItemStack itemStack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
@@ -492,36 +506,39 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public void setForm(byte form){
|
||||
if(form < 0)
|
||||
public void setForm(byte form) {
|
||||
if (form < 0)
|
||||
return;
|
||||
|
||||
switch(getRace()){
|
||||
switch (getRace()) {
|
||||
case 0:
|
||||
case 3:
|
||||
if(form > 3)
|
||||
if (form > 3)
|
||||
return;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if(form > 15)
|
||||
if (form > 15)
|
||||
return;
|
||||
break;
|
||||
case 4:
|
||||
if(form > 7)
|
||||
if (form > 7)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState",form);
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState", form);
|
||||
}
|
||||
public byte getForm(){
|
||||
|
||||
public byte getForm() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcState");
|
||||
}
|
||||
public void setForm2(byte form2){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState2",form2);
|
||||
|
||||
public void setForm2(byte form2) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState2", form2);
|
||||
}
|
||||
public byte getForm2(){
|
||||
|
||||
public byte getForm2() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcState2");
|
||||
}
|
||||
|
||||
@@ -530,11 +547,12 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
String formTree = this.getRacialTreeName();
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMastery" + formTree)) {
|
||||
String[] formMasteries = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
String masteryString = formMasteries[form];
|
||||
return Double.parseDouble(masteryString.split(",")[1]);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
@@ -543,7 +561,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
String formTree = this.getRacialTreeName();
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMastery" + formTree)) {
|
||||
String[] formMasteries = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
if (form >= formMasteries.length)
|
||||
return;
|
||||
|
||||
@@ -558,9 +576,10 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
setString("jrmcFormMastery" + formTree, String.valueOf(masteryString));
|
||||
setString("jrmcFormMastery" + formTree, String.valueOf(masteryString));
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void addRacialFormMastery(byte form, double value) {
|
||||
@@ -568,7 +587,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
String formTree = this.getRacialTreeName();
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMastery" + formTree)) {
|
||||
String[] formMasteries = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
getString("jrmcFormMastery" + formTree).split(";");
|
||||
if (form >= formMasteries.length)
|
||||
return;
|
||||
|
||||
@@ -584,9 +603,10 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
setString("jrmcFormMastery" + formTree, String.valueOf(masteryString));
|
||||
setString("jrmcFormMastery" + formTree, String.valueOf(masteryString));
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
private String getRacialTreeName() {
|
||||
@@ -611,7 +631,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
try {
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMasteryNonRacial")) {
|
||||
String masteryData = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
if (!masteryData.contains(formName)) {
|
||||
return 0.0D;
|
||||
}
|
||||
@@ -623,7 +643,8 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
@@ -631,7 +652,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
try {
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMasteryNonRacial")) {
|
||||
String masteryData = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
if (!masteryData.contains(formName)) {
|
||||
return;
|
||||
}
|
||||
@@ -653,16 +674,17 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
setString("jrmcFormMasteryNonRacial", String.valueOf(masteryString));
|
||||
setString("jrmcFormMasteryNonRacial", String.valueOf(masteryString));
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void addOtherFormMastery(String formName, double value) {
|
||||
try {
|
||||
if (player.getEntityData().getCompoundTag("PlayerPersisted").hasKey("jrmcFormMasteryNonRacial")) {
|
||||
String masteryData = player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
getString("jrmcFormMasteryNonRacial");
|
||||
if (!masteryData.contains(formName)) {
|
||||
return;
|
||||
}
|
||||
@@ -685,62 +707,69 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").
|
||||
setString("jrmcFormMasteryNonRacial", String.valueOf(masteryString));
|
||||
setString("jrmcFormMasteryNonRacial", String.valueOf(masteryString));
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPowerPoints(int points){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcArcRsrv",points);
|
||||
public void setPowerPoints(int points) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcArcRsrv", points);
|
||||
}
|
||||
public int getPowerPoints(){
|
||||
|
||||
public int getPowerPoints() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcArcRsrv");
|
||||
}
|
||||
|
||||
public void setAuraColor(int color){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcAuraColor",color);
|
||||
public void setAuraColor(int color) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setInteger("jrmcAuraColor", color);
|
||||
}
|
||||
public int getAuraColor(){
|
||||
|
||||
public int getAuraColor() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcAuraColor");
|
||||
}
|
||||
|
||||
public void setFormLevel(int level){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcSSltX","TR"+level);
|
||||
public void setFormLevel(int level) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcSSltX", "TR" + level);
|
||||
}
|
||||
public int getFormLevel(){
|
||||
|
||||
public int getFormLevel() {
|
||||
String formString = player.getEntityData().getCompoundTag("PlayerPersisted").getString("jrmcSSltX");
|
||||
if(formString.length() < 1)
|
||||
if (formString.length() < 1)
|
||||
return 0;
|
||||
|
||||
StringBuilder digitString = new StringBuilder();
|
||||
for(char c : formString.toCharArray()){
|
||||
if(Character.isDigit(c))
|
||||
for (char c : formString.toCharArray()) {
|
||||
if (Character.isDigit(c))
|
||||
digitString.append(c);
|
||||
}
|
||||
|
||||
if(digitString.length() < 1)
|
||||
if (digitString.length() < 1)
|
||||
return 0;
|
||||
|
||||
return Integer.parseInt(digitString.toString());
|
||||
}
|
||||
|
||||
public void setSkills(String skills){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcSSlts",skills);
|
||||
public void setSkills(String skills) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcSSlts", skills);
|
||||
}
|
||||
public String getSkills(){
|
||||
|
||||
public String getSkills() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getString("jrmcSSlts");
|
||||
}
|
||||
|
||||
public void setJRMCSE(String statusEffects){
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcStatusEff",statusEffects);
|
||||
public void setJRMCSE(String statusEffects) {
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setString("jrmcStatusEff", statusEffects);
|
||||
}
|
||||
public String getJRMCSE(){
|
||||
|
||||
public String getJRMCSE() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getString("jrmcStatusEff");
|
||||
}
|
||||
|
||||
public byte getDBCClass(){
|
||||
public byte getDBCClass() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcClass");
|
||||
}
|
||||
|
||||
public void setDBCClass(byte dbcClass) {
|
||||
if (dbcClass < 0 || dbcClass > 2)
|
||||
return;
|
||||
@@ -748,9 +777,10 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcClass", dbcClass);
|
||||
}
|
||||
|
||||
public int getRace(){
|
||||
public int getRace() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcRace");
|
||||
}
|
||||
|
||||
public void setRace(byte race) {
|
||||
if (race < 0 || race > 1)
|
||||
return;
|
||||
@@ -758,9 +788,10 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcRace", race);
|
||||
}
|
||||
|
||||
public int getPowerType(){
|
||||
public int getPowerType() {
|
||||
return player.getEntityData().getCompoundTag("PlayerPersisted").getByte("jrmcPwrtyp");
|
||||
}
|
||||
|
||||
public void setPowerType(byte powerType) {
|
||||
if (powerType < 0 || powerType > 1)
|
||||
return;
|
||||
@@ -768,7 +799,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcPwrtyp", powerType);
|
||||
}
|
||||
|
||||
public int getKillCount(String type){
|
||||
public int getKillCount(String type) {
|
||||
type = type.toLowerCase().trim();
|
||||
|
||||
int evilKills = player.getEntityData().getCompoundTag("PlayerPersisted").getInteger("jrmcKillCountEvil");
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -49,7 +49,7 @@ public class ScriptEntityItem<T extends EntityItem> extends ScriptEntity<T> impl
|
||||
|
||||
public void setAge(long age) {
|
||||
age = Math.max(Math.min(age, Integer.MAX_VALUE), Integer.MIN_VALUE);
|
||||
this.entity.age = (int)age;
|
||||
this.entity.age = (int) age;
|
||||
}
|
||||
|
||||
public int getLifeSpawn() {
|
||||
@@ -65,7 +65,7 @@ public class ScriptEntityItem<T extends EntityItem> extends ScriptEntity<T> impl
|
||||
}
|
||||
|
||||
public void setItem(IItemStack item) {
|
||||
ItemStack stack = item == null? null : item.getMCItemStack();
|
||||
ItemStack stack = item == null ? null : item.getMCItemStack();
|
||||
this.entity.setEntityItemStack(stack);
|
||||
}
|
||||
}
|
||||
@@ -8,156 +8,145 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> implements IEntityLiving {
|
||||
|
||||
public ScriptLiving(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttacking(){
|
||||
return super.isAttacking() || entity.getAttackTarget() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackTarget(IEntityLivingBase living){
|
||||
if(living == null)
|
||||
entity.setAttackTarget(null);
|
||||
else
|
||||
entity.setAttackTarget(living.getMCEntity());
|
||||
super.setAttackTarget(living);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingBase getAttackTarget(){
|
||||
IEntityLivingBase base = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAttackTarget());
|
||||
return (base != null)? base: super.getAttackTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start path finding toward this target
|
||||
* @param x Destination x position
|
||||
* @param y Destination x position
|
||||
* @param z Destination x position
|
||||
* @param speed Walking speed of the entity 0.7 is default
|
||||
*/
|
||||
public void navigateTo(double x, double y, double z, double speed){
|
||||
entity.getNavigator().tryMoveToXYZ(x, y, z, speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop navigating wherever this npc was walking to
|
||||
*/
|
||||
public void clearNavigation(){
|
||||
entity.getNavigator().clearPathEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this entity is navigating somewhere
|
||||
*/
|
||||
public boolean isNavigating(){
|
||||
return !entity.getNavigator().noPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeeEntity(IEntity entity){
|
||||
return this.entity.getEntitySenses().canSee(entity.getMCEntity());
|
||||
}
|
||||
|
||||
public void playLivingSound() {
|
||||
this.entity.playLivingSound();
|
||||
}
|
||||
|
||||
public void spawnExplosionParticle()
|
||||
{
|
||||
this.entity.spawnExplosionParticle();
|
||||
}
|
||||
|
||||
public void setMoveForward(float speed)
|
||||
{
|
||||
this.entity.setMoveForward(speed);
|
||||
}
|
||||
|
||||
public void faceEntity(IEntity entity, float pitch, float yaw)
|
||||
{
|
||||
this.entity.faceEntity(entity.getMCEntity(), pitch, yaw);
|
||||
}
|
||||
|
||||
public boolean canPickUpLoot()
|
||||
{
|
||||
return this.entity.canPickUpLoot();
|
||||
}
|
||||
|
||||
public void setCanPickUpLoot(boolean pickUp)
|
||||
{
|
||||
this.entity.setCanPickUpLoot(pickUp);
|
||||
}
|
||||
|
||||
public boolean isPersistent()
|
||||
{
|
||||
return this.entity.isNoDespawnRequired();
|
||||
}
|
||||
|
||||
public void enablePersistence() {
|
||||
this.entity.func_110163_bv();
|
||||
}
|
||||
|
||||
public void setCustomNameTag(String text)
|
||||
{
|
||||
this.entity.setCustomNameTag(text);
|
||||
}
|
||||
|
||||
public String getCustomNameTag()
|
||||
{
|
||||
return this.entity.getCustomNameTag();
|
||||
}
|
||||
|
||||
public boolean hasCustomNameTag()
|
||||
{
|
||||
return this.entity.hasCustomNameTag();
|
||||
}
|
||||
|
||||
public void setAlwaysRenderNameTag(boolean alwaysRender)
|
||||
{
|
||||
this.entity.setAlwaysRenderNameTag(alwaysRender);
|
||||
}
|
||||
|
||||
public boolean getAlwaysRenderNameTag()
|
||||
{
|
||||
return this.entity.getAlwaysRenderNameTag();
|
||||
}
|
||||
|
||||
public void clearLeashed(boolean sendPacket, boolean dropLeash)
|
||||
{
|
||||
this.entity.clearLeashed(sendPacket,dropLeash);
|
||||
}
|
||||
|
||||
public boolean allowLeashing() {
|
||||
return this.entity.allowLeashing();
|
||||
}
|
||||
|
||||
public boolean getLeashed() {
|
||||
return this.entity.getLeashed();
|
||||
}
|
||||
|
||||
public IEntity getLeashedTo() {
|
||||
return NpcAPI.Instance().getIEntity(entity.getLeashedToEntity());
|
||||
}
|
||||
|
||||
public void setLeashedTo(IEntity entity, boolean sendPacket) {
|
||||
this.entity.setLeashedToEntity(entity.getMCEntity(), sendPacket);
|
||||
}
|
||||
|
||||
public boolean canBeSteered() {
|
||||
return this.entity.canBeSteered();
|
||||
}
|
||||
public ScriptLiving(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
public boolean isAttacking() {
|
||||
return super.isAttacking() || entity.getAttackTarget() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackTarget(IEntityLivingBase living) {
|
||||
if (living == null)
|
||||
entity.setAttackTarget(null);
|
||||
else
|
||||
entity.setAttackTarget(living.getMCEntity());
|
||||
super.setAttackTarget(living);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingBase getAttackTarget() {
|
||||
IEntityLivingBase base = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAttackTarget());
|
||||
return (base != null) ? base : super.getAttackTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start path finding toward this target
|
||||
*
|
||||
* @param x Destination x position
|
||||
* @param y Destination x position
|
||||
* @param z Destination x position
|
||||
* @param speed Walking speed of the entity 0.7 is default
|
||||
*/
|
||||
public void navigateTo(double x, double y, double z, double speed) {
|
||||
entity.getNavigator().tryMoveToXYZ(x, y, z, speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop navigating wherever this npc was walking to
|
||||
*/
|
||||
public void clearNavigation() {
|
||||
entity.getNavigator().clearPathEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this entity is navigating somewhere
|
||||
*/
|
||||
public boolean isNavigating() {
|
||||
return !entity.getNavigator().noPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeeEntity(IEntity entity) {
|
||||
return this.entity.getEntitySenses().canSee(entity.getMCEntity());
|
||||
}
|
||||
|
||||
public void playLivingSound() {
|
||||
this.entity.playLivingSound();
|
||||
}
|
||||
|
||||
public void spawnExplosionParticle() {
|
||||
this.entity.spawnExplosionParticle();
|
||||
}
|
||||
|
||||
public void setMoveForward(float speed) {
|
||||
this.entity.setMoveForward(speed);
|
||||
}
|
||||
|
||||
public void faceEntity(IEntity entity, float pitch, float yaw) {
|
||||
this.entity.faceEntity(entity.getMCEntity(), pitch, yaw);
|
||||
}
|
||||
|
||||
public boolean canPickUpLoot() {
|
||||
return this.entity.canPickUpLoot();
|
||||
}
|
||||
|
||||
public void setCanPickUpLoot(boolean pickUp) {
|
||||
this.entity.setCanPickUpLoot(pickUp);
|
||||
}
|
||||
|
||||
public boolean isPersistent() {
|
||||
return this.entity.isNoDespawnRequired();
|
||||
}
|
||||
|
||||
public void enablePersistence() {
|
||||
this.entity.func_110163_bv();
|
||||
}
|
||||
|
||||
public void setCustomNameTag(String text) {
|
||||
this.entity.setCustomNameTag(text);
|
||||
}
|
||||
|
||||
public String getCustomNameTag() {
|
||||
return this.entity.getCustomNameTag();
|
||||
}
|
||||
|
||||
public boolean hasCustomNameTag() {
|
||||
return this.entity.hasCustomNameTag();
|
||||
}
|
||||
|
||||
public void setAlwaysRenderNameTag(boolean alwaysRender) {
|
||||
this.entity.setAlwaysRenderNameTag(alwaysRender);
|
||||
}
|
||||
|
||||
public boolean getAlwaysRenderNameTag() {
|
||||
return this.entity.getAlwaysRenderNameTag();
|
||||
}
|
||||
|
||||
public void clearLeashed(boolean sendPacket, boolean dropLeash) {
|
||||
this.entity.clearLeashed(sendPacket, dropLeash);
|
||||
}
|
||||
|
||||
public boolean allowLeashing() {
|
||||
return this.entity.allowLeashing();
|
||||
}
|
||||
|
||||
public boolean getLeashed() {
|
||||
return this.entity.getLeashed();
|
||||
}
|
||||
|
||||
public IEntity getLeashedTo() {
|
||||
return NpcAPI.Instance().getIEntity(entity.getLeashedToEntity());
|
||||
}
|
||||
|
||||
public void setLeashedTo(IEntity entity, boolean sendPacket) {
|
||||
this.entity.setLeashedToEntity(entity.getMCEntity(), sendPacket);
|
||||
}
|
||||
|
||||
public boolean canBeSteered() {
|
||||
return this.entity.canBeSteered();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation) {
|
||||
super.setRotation(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), rotation, getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(float rotation){
|
||||
public void setPitch(float rotation) {
|
||||
super.setPitch(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), getRotation(), rotation);
|
||||
}
|
||||
|
||||
@@ -21,357 +21,357 @@ import java.util.Collections;
|
||||
|
||||
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase {
|
||||
|
||||
public ScriptLivingBase(T entity){
|
||||
super(entity);
|
||||
}
|
||||
public ScriptLivingBase(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The entity's current health
|
||||
*/
|
||||
public float getHealth(){
|
||||
return entity.getHealth();
|
||||
}
|
||||
/**
|
||||
* @return The entity's current health
|
||||
*/
|
||||
public float getHealth() {
|
||||
return entity.getHealth();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param health The new health of this entity
|
||||
*/
|
||||
public void setHealth(float health){
|
||||
entity.setHealth(health);
|
||||
}
|
||||
/**
|
||||
* @param health The new health of this entity
|
||||
*/
|
||||
public void setHealth(float health) {
|
||||
entity.setHealth(health);
|
||||
}
|
||||
|
||||
public void hurt(float damage){
|
||||
entity.attackEntityFrom(DamageSource.generic,damage);
|
||||
}
|
||||
public void hurt(float damage) {
|
||||
entity.attackEntityFrom(DamageSource.generic, damage);
|
||||
}
|
||||
|
||||
public void hurt(float damage, IEntity source) {
|
||||
if(source.getType() == 1)//if player
|
||||
entity.attackEntityFrom(new EntityDamageSource("player",source.getMCEntity()),damage);
|
||||
else
|
||||
entity.attackEntityFrom(new EntityDamageSource(source.getTypeName(),source.getMCEntity()),damage);
|
||||
}
|
||||
public void hurt(float damage, IEntity source) {
|
||||
if (source.getType() == 1)//if player
|
||||
entity.attackEntityFrom(new EntityDamageSource("player", source.getMCEntity()), damage);
|
||||
else
|
||||
entity.attackEntityFrom(new EntityDamageSource(source.getTypeName(), source.getMCEntity()), damage);
|
||||
}
|
||||
|
||||
public void hurt(float damage, IDamageSource damageSource) {
|
||||
entity.attackEntityFrom(damageSource.getMCDamageSource(),damage);
|
||||
}
|
||||
public void hurt(float damage, IDamageSource damageSource) {
|
||||
entity.attackEntityFrom(damageSource.getMCDamageSource(), damage);
|
||||
}
|
||||
|
||||
public void setMaxHurtTime(int time) {
|
||||
entity.maxHurtResistantTime = time;
|
||||
}
|
||||
public void setMaxHurtTime(int time) {
|
||||
entity.maxHurtResistantTime = time;
|
||||
}
|
||||
|
||||
public int setMaxHurtTime() {
|
||||
return entity.maxHurtResistantTime;
|
||||
}
|
||||
public int setMaxHurtTime() {
|
||||
return entity.maxHurtResistantTime;
|
||||
}
|
||||
|
||||
public double getMaxHealth(){
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue();
|
||||
}
|
||||
public double getMaxHealth() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getFollowRange() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.followRange).getAttributeValue();
|
||||
}
|
||||
public double getFollowRange() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.followRange).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getKnockbackResistance() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
|
||||
}
|
||||
public double getKnockbackResistance() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
|
||||
}
|
||||
public double getSpeed() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getMeleeStrength() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
||||
}
|
||||
public double getMeleeStrength() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
||||
}
|
||||
|
||||
public void setMaxHealth(double health){
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health);
|
||||
}
|
||||
public void setMaxHealth(double health) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health);
|
||||
}
|
||||
|
||||
public void setFollowRange(double range) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(range);
|
||||
}
|
||||
public void setFollowRange(double range) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(range);
|
||||
}
|
||||
|
||||
public void setKnockbackResistance(double knockbackResistance) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(knockbackResistance);
|
||||
}
|
||||
public void setKnockbackResistance(double knockbackResistance) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(knockbackResistance);
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(speed);
|
||||
}
|
||||
public void setSpeed(double speed) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(speed);
|
||||
}
|
||||
|
||||
public void setMeleeStrength(double attackDamage) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamage);
|
||||
}
|
||||
public void setMeleeStrength(double attackDamage) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this entity is attacking something
|
||||
*/
|
||||
public boolean isAttacking(){
|
||||
return entity.getAITarget() != null;
|
||||
}
|
||||
/**
|
||||
* @return Whether or not this entity is attacking something
|
||||
*/
|
||||
public boolean isAttacking() {
|
||||
return entity.getAITarget() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param living Entity which this entity will attack
|
||||
*/
|
||||
public void setAttackTarget(IEntityLivingBase living){
|
||||
if(living == null)
|
||||
entity.setRevengeTarget(null);
|
||||
else
|
||||
entity.setRevengeTarget(living.getMCEntity());
|
||||
}
|
||||
/**
|
||||
* @param living Entity which this entity will attack
|
||||
*/
|
||||
public void setAttackTarget(IEntityLivingBase living) {
|
||||
if (living == null)
|
||||
entity.setRevengeTarget(null);
|
||||
else
|
||||
entity.setRevengeTarget(living.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The entity which this entity is attacking
|
||||
*/
|
||||
public IEntityLivingBase getAttackTarget(){
|
||||
return (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity.getAITarget());
|
||||
}
|
||||
/**
|
||||
* @return The entity which this entity is attacking
|
||||
*/
|
||||
public IEntityLivingBase getAttackTarget() {
|
||||
return (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAITarget());
|
||||
}
|
||||
|
||||
public int getAttackTargetTime() {
|
||||
return this.entity.func_142015_aE();
|
||||
}
|
||||
public int getAttackTargetTime() {
|
||||
return this.entity.func_142015_aE();
|
||||
}
|
||||
|
||||
public void setLastAttacker(IEntity p_130011_1_) {
|
||||
this.entity.setLastAttacker(p_130011_1_.getMCEntity());
|
||||
}
|
||||
public void setLastAttacker(IEntity p_130011_1_) {
|
||||
this.entity.setLastAttacker(p_130011_1_.getMCEntity());
|
||||
}
|
||||
|
||||
public IEntity getLastAttacker() {
|
||||
return NpcAPI.Instance().getIEntity(this.entity.getLastAttacker());
|
||||
}
|
||||
public IEntity getLastAttacker() {
|
||||
return NpcAPI.Instance().getIEntity(this.entity.getLastAttacker());
|
||||
}
|
||||
|
||||
public int getLastAttackerTime()
|
||||
{
|
||||
return this.entity.getLastAttackerTime();
|
||||
}
|
||||
public int getLastAttackerTime() {
|
||||
return this.entity.getLastAttackerTime();
|
||||
}
|
||||
|
||||
public boolean canBreatheUnderwater() {
|
||||
return this.entity.canBreatheUnderwater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
return EntityType.LIVING;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type){
|
||||
return type == EntityType.LIVING || super.typeOf(type);
|
||||
}
|
||||
/**
|
||||
* @param entity Entity to check
|
||||
* @return Whether or not this entity can see the given entity
|
||||
*/
|
||||
public boolean canSeeEntity(IEntity entity){
|
||||
return this.entity.canEntityBeSeen(entity.getMCEntity());
|
||||
}
|
||||
|
||||
public IPos getLookVector() {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
return NpcAPI.Instance().getIPos(lookVec.xCoord,lookVec.yCoord,lookVec.zCoord);
|
||||
}
|
||||
|
||||
public IBlock getLookingAtBlock(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
return NpcAPI.Instance().getIBlock(getWorld(),getLookingAtPos(maxDistance, stopOnBlock, stopOnLiquid, stopOnCollision));
|
||||
}
|
||||
|
||||
public IBlock getLookingAtBlock(int maxDistance) {
|
||||
return getLookingAtBlock(maxDistance, true, false, false);
|
||||
}
|
||||
|
||||
public IPos getLookingAtPos(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
return getWorld().rayCastPos(
|
||||
new double[] {entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ},
|
||||
new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
|
||||
maxDistance, stopOnBlock, stopOnLiquid, stopOnCollision);
|
||||
}
|
||||
|
||||
public IPos getLookingAtPos(int maxDistance) {
|
||||
return getLookingAtPos(maxDistance, true, false, false);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(IEntity[] ignoreEntities, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
double[] startPos = new double[] {entity.posX, entity.posY+entity.getEyeHeight(), entity.posZ};
|
||||
double[] lookVector = new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord};
|
||||
|
||||
if (ignoreEntities == null) {
|
||||
ignoreEntities = new IEntity<?>[0];
|
||||
}
|
||||
ArrayList<IEntity> entities = new ArrayList<>();
|
||||
entities.add(this);
|
||||
Collections.addAll(entities, ignoreEntities);
|
||||
|
||||
return getWorld().rayCastEntities(entities.toArray(new IEntity[0]),startPos,lookVector,maxDistance,offset,range,stopOnBlock,stopOnLiquid,stopOnCollision);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
return this.getLookingAtEntities(null,maxDistance,offset,range,stopOnBlock,stopOnLiquid,stopOnCollision);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(int maxDistance, double offset, double range) {
|
||||
return getLookingAtEntities(maxDistance,offset,range,true,false,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expert use only
|
||||
* @return Returns the minecraft entity object
|
||||
*/
|
||||
public T getMCEntity(){
|
||||
return entity;
|
||||
}
|
||||
|
||||
public T getMinecraftEntity(){
|
||||
return getMCEntity();
|
||||
}
|
||||
public boolean canBreatheUnderwater() {
|
||||
return this.entity.canBreatheUnderwater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation(){
|
||||
public int getType() {
|
||||
return EntityType.LIVING;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.LIVING || super.typeOf(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity Entity to check
|
||||
* @return Whether or not this entity can see the given entity
|
||||
*/
|
||||
public boolean canSeeEntity(IEntity entity) {
|
||||
return this.entity.canEntityBeSeen(entity.getMCEntity());
|
||||
}
|
||||
|
||||
public IPos getLookVector() {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
return NpcAPI.Instance().getIPos(lookVec.xCoord, lookVec.yCoord, lookVec.zCoord);
|
||||
}
|
||||
|
||||
public IBlock getLookingAtBlock(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
return NpcAPI.Instance().getIBlock(getWorld(), getLookingAtPos(maxDistance, stopOnBlock, stopOnLiquid, stopOnCollision));
|
||||
}
|
||||
|
||||
public IBlock getLookingAtBlock(int maxDistance) {
|
||||
return getLookingAtBlock(maxDistance, true, false, false);
|
||||
}
|
||||
|
||||
public IPos getLookingAtPos(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
return getWorld().rayCastPos(
|
||||
new double[]{entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ},
|
||||
new double[]{lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
|
||||
maxDistance, stopOnBlock, stopOnLiquid, stopOnCollision);
|
||||
}
|
||||
|
||||
public IPos getLookingAtPos(int maxDistance) {
|
||||
return getLookingAtPos(maxDistance, true, false, false);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(IEntity[] ignoreEntities, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
Vec3 lookVec = entity.getLookVec();
|
||||
double[] startPos = new double[]{entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ};
|
||||
double[] lookVector = new double[]{lookVec.xCoord, lookVec.yCoord, lookVec.zCoord};
|
||||
|
||||
if (ignoreEntities == null) {
|
||||
ignoreEntities = new IEntity<?>[0];
|
||||
}
|
||||
ArrayList<IEntity> entities = new ArrayList<>();
|
||||
entities.add(this);
|
||||
Collections.addAll(entities, ignoreEntities);
|
||||
|
||||
return getWorld().rayCastEntities(entities.toArray(new IEntity[0]), startPos, lookVector, maxDistance, offset, range, stopOnBlock, stopOnLiquid, stopOnCollision);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision) {
|
||||
return this.getLookingAtEntities(null, maxDistance, offset, range, stopOnBlock, stopOnLiquid, stopOnCollision);
|
||||
}
|
||||
|
||||
public IEntity[] getLookingAtEntities(int maxDistance, double offset, double range) {
|
||||
return getLookingAtEntities(maxDistance, offset, range, true, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expert use only
|
||||
*
|
||||
* @return Returns the minecraft entity object
|
||||
*/
|
||||
public T getMCEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public T getMinecraftEntity() {
|
||||
return getMCEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation() {
|
||||
return entity.renderYawOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
public void setRotation(float rotation) {
|
||||
entity.renderYawOffset = rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the entity swing its hand
|
||||
*/
|
||||
public void swingHand(){
|
||||
entity.swingItem();
|
||||
}
|
||||
/**
|
||||
* Makes the entity swing its hand
|
||||
*/
|
||||
public void swingHand() {
|
||||
entity.swingItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Works the same as the <a href="http://minecraft.wiki/w/Commands#effect">/effect command</a>
|
||||
* @param effect
|
||||
* @param duration The duration in seconds
|
||||
* @param strength The amplifier of the potion effect
|
||||
* @param hideParticles Whether or not you want to hide potion particles
|
||||
*/
|
||||
public void addPotionEffect(int effect, int duration, int strength, boolean hideParticles){
|
||||
/**
|
||||
* Works the same as the <a href="http://minecraft.wiki/w/Commands#effect">/effect command</a>
|
||||
*
|
||||
* @param effect
|
||||
* @param duration The duration in seconds
|
||||
* @param strength The amplifier of the potion effect
|
||||
* @param hideParticles Whether or not you want to hide potion particles
|
||||
*/
|
||||
public void addPotionEffect(int effect, int duration, int strength, boolean hideParticles) {
|
||||
if (effect < 0 || effect >= Potion.potionTypes.length || Potion.potionTypes[effect] == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
if(strength < 0)
|
||||
strength = 0;
|
||||
if (strength < 0)
|
||||
strength = 0;
|
||||
|
||||
if(duration < 0)
|
||||
duration = 0;
|
||||
if (duration < 0)
|
||||
duration = 0;
|
||||
|
||||
if(!Potion.potionTypes[effect].isInstant())
|
||||
duration *= 20;
|
||||
if (!Potion.potionTypes[effect].isInstant())
|
||||
duration *= 20;
|
||||
|
||||
if(duration == 0)
|
||||
entity.removePotionEffect(effect);
|
||||
else
|
||||
entity.addPotionEffect(new PotionEffect(effect, duration, strength));
|
||||
//TODO in 1.8 add hideParticles option
|
||||
}
|
||||
if (duration == 0)
|
||||
entity.removePotionEffect(effect);
|
||||
else
|
||||
entity.addPotionEffect(new PotionEffect(effect, duration, strength));
|
||||
//TODO in 1.8 add hideParticles option
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all potion effects
|
||||
*/
|
||||
public void clearPotionEffects(){
|
||||
entity.clearActivePotions();
|
||||
}
|
||||
/**
|
||||
* Clears all potion effects
|
||||
*/
|
||||
public void clearPotionEffects() {
|
||||
entity.clearActivePotions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param effect Potion effect to check
|
||||
* @return Returns -1 if its not active. Otherwise returns the strenght of the potion
|
||||
*/
|
||||
public int getPotionEffect(int effect){
|
||||
PotionEffect pf = entity.getActivePotionEffect(Potion.potionTypes[effect]);
|
||||
if(pf == null)
|
||||
return -1;
|
||||
return pf.getAmplifier();
|
||||
}
|
||||
/**
|
||||
* @param effect Potion effect to check
|
||||
* @return Returns -1 if its not active. Otherwise returns the strenght of the potion
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
public int getPotionEffect(int effect) {
|
||||
PotionEffect pf = entity.getActivePotionEffect(Potion.potionTypes[effect]);
|
||||
if (pf == null)
|
||||
return -1;
|
||||
return pf.getAmplifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
* @since 1.7.10c
|
||||
* @return The item the entity is holding
|
||||
*/
|
||||
public IItemStack getHeldItem(){
|
||||
return NpcAPI.Instance().getIItemStack(entity.getHeldItem());
|
||||
}
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
*
|
||||
* @return The item the entity is holding
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
public IItemStack getHeldItem() {
|
||||
return NpcAPI.Instance().getIItemStack(entity.getHeldItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
* @since 1.7.10c
|
||||
* @param item The item to be set
|
||||
*/
|
||||
public void setHeldItem(IItemStack item){
|
||||
entity.setCurrentItemOrArmor(0, item == null?null:item.getMCItemStack());
|
||||
}
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
*
|
||||
* @param item The item to be set
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
public void setHeldItem(IItemStack item) {
|
||||
entity.setCurrentItemOrArmor(0, item == null ? null : item.getMCItemStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
* @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head
|
||||
* @return The item in the given slot
|
||||
*/
|
||||
public IItemStack getArmor(int slot){
|
||||
return NpcAPI.Instance().getIItemStack(entity.getEquipmentInSlot(slot + 1));
|
||||
}
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
*
|
||||
* @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head
|
||||
* @return The item in the given slot
|
||||
*/
|
||||
public IItemStack getArmor(int slot) {
|
||||
return NpcAPI.Instance().getIItemStack(entity.getEquipmentInSlot(slot + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
* @since 1.7.10c
|
||||
* @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head
|
||||
* @param item Item to be set
|
||||
*/
|
||||
public void setArmor(int slot, IItemStack item){
|
||||
entity.setCurrentItemOrArmor(slot + 1, item == null?null:item.getMCItemStack());
|
||||
}
|
||||
/**
|
||||
* Note not all Living Entities support this
|
||||
*
|
||||
* @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head
|
||||
* @param item Item to be set
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
public void setArmor(int slot, IItemStack item) {
|
||||
entity.setCurrentItemOrArmor(slot + 1, item == null ? null : item.getMCItemStack());
|
||||
}
|
||||
|
||||
public boolean isChild() {
|
||||
return this.entity.isChild();
|
||||
}
|
||||
public boolean isChild() {
|
||||
return this.entity.isChild();
|
||||
}
|
||||
|
||||
public void renderBrokenItemStack(IItemStack itemStack)
|
||||
{
|
||||
this.entity.renderBrokenItemStack(itemStack.getMCItemStack());
|
||||
}
|
||||
public void renderBrokenItemStack(IItemStack itemStack) {
|
||||
this.entity.renderBrokenItemStack(itemStack.getMCItemStack());
|
||||
}
|
||||
|
||||
public boolean isOnLadder()
|
||||
{
|
||||
return this.entity.isOnLadder();
|
||||
}
|
||||
public boolean isOnLadder() {
|
||||
return this.entity.isOnLadder();
|
||||
}
|
||||
|
||||
public int getTotalArmorValue()
|
||||
{
|
||||
return this.entity.getTotalArmorValue();
|
||||
}
|
||||
public int getTotalArmorValue() {
|
||||
return this.entity.getTotalArmorValue();
|
||||
}
|
||||
|
||||
public int getArrowCountInEntity() {
|
||||
return this.entity.getArrowCountInEntity();
|
||||
}
|
||||
public int getArrowCountInEntity() {
|
||||
return this.entity.getArrowCountInEntity();
|
||||
}
|
||||
|
||||
public void setArrowCountInEntity(int count)
|
||||
{
|
||||
this.entity.setArrowCountInEntity(count);
|
||||
}
|
||||
public void setArrowCountInEntity(int count) {
|
||||
this.entity.setArrowCountInEntity(count);
|
||||
}
|
||||
|
||||
public void dismountEntity(IEntity entity) {
|
||||
this.entity.dismountEntity(entity.getMCEntity());
|
||||
}
|
||||
public void dismountEntity(IEntity entity) {
|
||||
this.entity.dismountEntity(entity.getMCEntity());
|
||||
}
|
||||
|
||||
public void setAIMoveSpeed(float speed)
|
||||
{
|
||||
this.entity.setAIMoveSpeed(speed);
|
||||
}
|
||||
public void setAIMoveSpeed(float speed) {
|
||||
this.entity.setAIMoveSpeed(speed);
|
||||
}
|
||||
|
||||
public float getAIMoveSpeed() {
|
||||
return this.entity.getAIMoveSpeed();
|
||||
}
|
||||
public float getAIMoveSpeed() {
|
||||
return this.entity.getAIMoveSpeed();
|
||||
}
|
||||
|
||||
public void setAbsorptionAmount(float amount)
|
||||
{
|
||||
this.entity.setAbsorptionAmount(amount);
|
||||
}
|
||||
public void setAbsorptionAmount(float amount) {
|
||||
this.entity.setAbsorptionAmount(amount);
|
||||
}
|
||||
|
||||
public float getAbsorptionAmount() {
|
||||
return this.entity.getAbsorptionAmount();
|
||||
}
|
||||
public float getAbsorptionAmount() {
|
||||
return this.entity.getAbsorptionAmount();
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,18 @@ import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptMonster<T extends EntityMob> extends ScriptLiving<T> implements IMonster {
|
||||
|
||||
public ScriptMonster(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
return EntityType.MONSTER;
|
||||
}
|
||||
public ScriptMonster(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type){
|
||||
return type == EntityType.MONSTER?true:super.typeOf(type);
|
||||
}
|
||||
@Override
|
||||
public int getType() {
|
||||
return EntityType.MONSTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.MONSTER ? true : super.typeOf(type);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,267 +8,268 @@ import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptPixelmon<T extends EntityTameable> extends ScriptAnimal<T> implements IPixelmon {
|
||||
private T pixelmon;
|
||||
private NBTTagCompound compound = null;
|
||||
public ScriptPixelmon(T pixelmon){
|
||||
super(pixelmon);
|
||||
this.pixelmon = pixelmon;
|
||||
compound = new NBTTagCompound();
|
||||
pixelmon.writeEntityToNBT(compound);
|
||||
}
|
||||
public ScriptPixelmon(T pixelmon, NBTTagCompound compound){
|
||||
this(pixelmon);
|
||||
this.compound = compound;
|
||||
}
|
||||
private T pixelmon;
|
||||
private NBTTagCompound compound = null;
|
||||
|
||||
public boolean getIsShiny(){
|
||||
return compound.getBoolean("IsShiny");
|
||||
}
|
||||
public ScriptPixelmon(T pixelmon) {
|
||||
super(pixelmon);
|
||||
this.pixelmon = pixelmon;
|
||||
compound = new NBTTagCompound();
|
||||
pixelmon.writeEntityToNBT(compound);
|
||||
}
|
||||
|
||||
public void setIsShiny(boolean bo){
|
||||
compound.setBoolean("IsShiny", bo);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
public ScriptPixelmon(T pixelmon, NBTTagCompound compound) {
|
||||
this(pixelmon);
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public int getLevel(){
|
||||
return compound.getInteger("Level");
|
||||
}
|
||||
public boolean getIsShiny() {
|
||||
return compound.getBoolean("IsShiny");
|
||||
}
|
||||
|
||||
public void setLevel(int level){
|
||||
compound.setInteger("Level", level);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
public void setIsShiny(boolean bo) {
|
||||
compound.setBoolean("IsShiny", bo);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getIV(int type){
|
||||
if(type == 0)
|
||||
return compound.getInteger("IVHP");
|
||||
if(type == 1)
|
||||
return compound.getInteger("IVAttack");
|
||||
if(type == 2)
|
||||
return compound.getInteger("IVDefence");
|
||||
if(type == 3)
|
||||
return compound.getInteger("IVSpAtt");
|
||||
if(type == 4)
|
||||
return compound.getInteger("IVSpDef");
|
||||
if(type == 5)
|
||||
return compound.getInteger("IVSpeed");
|
||||
public int getLevel() {
|
||||
return compound.getInteger("Level");
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
public void setLevel(int level) {
|
||||
compound.setInteger("Level", level);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getIV(int type) {
|
||||
if (type == 0)
|
||||
return compound.getInteger("IVHP");
|
||||
if (type == 1)
|
||||
return compound.getInteger("IVAttack");
|
||||
if (type == 2)
|
||||
return compound.getInteger("IVDefence");
|
||||
if (type == 3)
|
||||
return compound.getInteger("IVSpAtt");
|
||||
if (type == 4)
|
||||
return compound.getInteger("IVSpDef");
|
||||
if (type == 5)
|
||||
return compound.getInteger("IVSpeed");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setIV(int type, int value){
|
||||
if(type == 0)
|
||||
compound.setInteger("IVHP", value);
|
||||
else if(type == 1)
|
||||
compound.setInteger("IVAttack", value);
|
||||
else if(type == 2)
|
||||
compound.setInteger("IVDefence", value);
|
||||
else if(type == 3)
|
||||
compound.setInteger("IVSpAtt", value);
|
||||
else if(type == 4)
|
||||
compound.setInteger("IVSpDef", value);
|
||||
else if(type == 5)
|
||||
compound.setInteger("IVSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setIV(int type, int value) {
|
||||
if (type == 0)
|
||||
compound.setInteger("IVHP", value);
|
||||
else if (type == 1)
|
||||
compound.setInteger("IVAttack", value);
|
||||
else if (type == 2)
|
||||
compound.setInteger("IVDefence", value);
|
||||
else if (type == 3)
|
||||
compound.setInteger("IVSpAtt", value);
|
||||
else if (type == 4)
|
||||
compound.setInteger("IVSpDef", value);
|
||||
else if (type == 5)
|
||||
compound.setInteger("IVSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getEV(int type){
|
||||
if(type == 0)
|
||||
return compound.getInteger("EVHP");
|
||||
if(type == 1)
|
||||
return compound.getInteger("EVAttack");
|
||||
if(type == 2)
|
||||
return compound.getInteger("EVDefence");
|
||||
if(type == 3)
|
||||
return compound.getInteger("EVSpecialAttack");
|
||||
if(type == 4)
|
||||
return compound.getInteger("EVSpecialDefence");
|
||||
if(type == 5)
|
||||
return compound.getInteger("EVSpeed");
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getEV(int type) {
|
||||
if (type == 0)
|
||||
return compound.getInteger("EVHP");
|
||||
if (type == 1)
|
||||
return compound.getInteger("EVAttack");
|
||||
if (type == 2)
|
||||
return compound.getInteger("EVDefence");
|
||||
if (type == 3)
|
||||
return compound.getInteger("EVSpecialAttack");
|
||||
if (type == 4)
|
||||
return compound.getInteger("EVSpecialDefence");
|
||||
if (type == 5)
|
||||
return compound.getInteger("EVSpeed");
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setEV(int type, int value){
|
||||
if(type == 0)
|
||||
compound.setInteger("EVHP", value);
|
||||
else if(type == 1)
|
||||
compound.setInteger("EVAttack", value);
|
||||
else if(type == 2)
|
||||
compound.setInteger("EVDefence", value);
|
||||
else if(type == 3)
|
||||
compound.setInteger("EVSpecialAttack", value);
|
||||
else if(type == 4)
|
||||
compound.setInteger("EVSpecialDefence", value);
|
||||
else if(type == 5)
|
||||
compound.setInteger("EVSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setEV(int type, int value) {
|
||||
if (type == 0)
|
||||
compound.setInteger("EVHP", value);
|
||||
else if (type == 1)
|
||||
compound.setInteger("EVAttack", value);
|
||||
else if (type == 2)
|
||||
compound.setInteger("EVDefence", value);
|
||||
else if (type == 3)
|
||||
compound.setInteger("EVSpecialAttack", value);
|
||||
else if (type == 4)
|
||||
compound.setInteger("EVSpecialDefence", value);
|
||||
else if (type == 5)
|
||||
compound.setInteger("EVSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getStat(int type){
|
||||
if(type == 0)
|
||||
return compound.getInteger("StatsHP");
|
||||
if(type == 1)
|
||||
return compound.getInteger("StatsAttack");
|
||||
if(type == 2)
|
||||
return compound.getInteger("StatsDefence");
|
||||
if(type == 3)
|
||||
return compound.getInteger("StatsSpecialAttack");
|
||||
if(type == 4)
|
||||
return compound.getInteger("StatsSpecialDefence");
|
||||
if(type == 5)
|
||||
return compound.getInteger("StatsSpeed");
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public int getStat(int type) {
|
||||
if (type == 0)
|
||||
return compound.getInteger("StatsHP");
|
||||
if (type == 1)
|
||||
return compound.getInteger("StatsAttack");
|
||||
if (type == 2)
|
||||
return compound.getInteger("StatsDefence");
|
||||
if (type == 3)
|
||||
return compound.getInteger("StatsSpecialAttack");
|
||||
if (type == 4)
|
||||
return compound.getInteger("StatsSpecialDefence");
|
||||
if (type == 5)
|
||||
return compound.getInteger("StatsSpeed");
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setStat(int type, int value){
|
||||
if(type == 0)
|
||||
compound.setInteger("StatsHP", value);
|
||||
else if(type == 1)
|
||||
compound.setInteger("StatsAttack", value);
|
||||
else if(type == 2)
|
||||
compound.setInteger("StatsDefence", value);
|
||||
else if(type == 3)
|
||||
compound.setInteger("StatsSpecialAttack", value);
|
||||
else if(type == 4)
|
||||
compound.setInteger("StatsSpecialDefence", value);
|
||||
else if(type == 5)
|
||||
compound.setInteger("StatsSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
|
||||
*/
|
||||
public void setStat(int type, int value) {
|
||||
if (type == 0)
|
||||
compound.setInteger("StatsHP", value);
|
||||
else if (type == 1)
|
||||
compound.setInteger("StatsAttack", value);
|
||||
else if (type == 2)
|
||||
compound.setInteger("StatsDefence", value);
|
||||
else if (type == 3)
|
||||
compound.setInteger("StatsSpecialAttack", value);
|
||||
else if (type == 4)
|
||||
compound.setInteger("StatsSpecialDefence", value);
|
||||
else if (type == 5)
|
||||
compound.setInteger("StatsSpeed", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
|
||||
*/
|
||||
public int getSize(){
|
||||
return compound.getShort("Growth");
|
||||
}
|
||||
/**
|
||||
* @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
|
||||
*/
|
||||
public int getSize() {
|
||||
return compound.getShort("Growth");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
|
||||
*/
|
||||
public void setSize(int type){
|
||||
compound.setShort("Growth", (short) type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
|
||||
*/
|
||||
public void setSize(int type) {
|
||||
compound.setShort("Growth", (short) type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 0-255
|
||||
*/
|
||||
public int getHapiness(){
|
||||
return compound.getInteger("Friendship");
|
||||
}
|
||||
/**
|
||||
* @return 0-255
|
||||
*/
|
||||
public int getHapiness() {
|
||||
return compound.getInteger("Friendship");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value 0-255
|
||||
*/
|
||||
public void setHapiness(int value){
|
||||
value = ValueUtil.clamp(value, 0, 255);
|
||||
compound.setInteger("Friendship", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param value 0-255
|
||||
*/
|
||||
public void setHapiness(int value) {
|
||||
value = ValueUtil.clamp(value, 0, 255);
|
||||
compound.setInteger("Friendship", value);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful
|
||||
*/
|
||||
public int getNature(){
|
||||
return compound.getShort("Nature");
|
||||
}
|
||||
/**
|
||||
* @return 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful
|
||||
*/
|
||||
public int getNature() {
|
||||
return compound.getShort("Nature");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful
|
||||
*/
|
||||
public void setNature(int type){
|
||||
compound.setShort("Nature", (short) type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful
|
||||
*/
|
||||
public void setNature(int type) {
|
||||
compound.setShort("Nature", (short) type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall
|
||||
*/
|
||||
public int getPokeball(){
|
||||
if(compound.hasKey("CaughtBall"))
|
||||
return -1;
|
||||
return compound.getInteger("CaughtBall");
|
||||
}
|
||||
/**
|
||||
* @return -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall
|
||||
*/
|
||||
public int getPokeball() {
|
||||
if (compound.hasKey("CaughtBall"))
|
||||
return -1;
|
||||
return compound.getInteger("CaughtBall");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall
|
||||
*/
|
||||
public void setPokeball(int type){
|
||||
compound.setInteger("CaughtBall", type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
/**
|
||||
* @param type -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall
|
||||
*/
|
||||
public void setPokeball(int type) {
|
||||
compound.setInteger("CaughtBall", type);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
public String getNickname(){
|
||||
return compound.getString("Nickname");
|
||||
}
|
||||
public String getNickname() {
|
||||
return compound.getString("Nickname");
|
||||
}
|
||||
|
||||
public boolean hasNickname(){
|
||||
return !getNickname().isEmpty();
|
||||
}
|
||||
public boolean hasNickname() {
|
||||
return !getNickname().isEmpty();
|
||||
}
|
||||
|
||||
public void setNickname(String name){
|
||||
compound.setString("Nickname", name);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
public void setNickname(String name) {
|
||||
compound.setString("Nickname", name);
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
public String getMove(int slot){
|
||||
if(!compound.hasKey("PixelmonMoveID" + slot))
|
||||
return null;
|
||||
return PixelmonHelper.getAttackName(compound.getInteger("PixelmonMoveID" + slot));
|
||||
}
|
||||
public String getMove(int slot) {
|
||||
if (!compound.hasKey("PixelmonMoveID" + slot))
|
||||
return null;
|
||||
return PixelmonHelper.getAttackName(compound.getInteger("PixelmonMoveID" + slot));
|
||||
}
|
||||
|
||||
public void setMove(int slot, String move){
|
||||
slot = ValueUtil.clamp(slot, 0, 3);
|
||||
int id = PixelmonHelper.getAttackID(move);
|
||||
compound.removeTag("PixelmonMovePP" + slot);
|
||||
compound.removeTag("PixelmonMovePPBase" + slot);
|
||||
if(id < 0){
|
||||
compound.removeTag("PixelmonMoveID" + slot);
|
||||
}
|
||||
else{
|
||||
compound.setInteger("PixelmonMoveID" + slot, id);
|
||||
}
|
||||
int size = 0;
|
||||
for(int i = 0; i < 4; i++){
|
||||
if(compound.hasKey("PixelmonMoveID" + i))
|
||||
size++;
|
||||
}
|
||||
compound.setInteger("PixelmonNumberMoves", size);
|
||||
public void setMove(int slot, String move) {
|
||||
slot = ValueUtil.clamp(slot, 0, 3);
|
||||
int id = PixelmonHelper.getAttackID(move);
|
||||
compound.removeTag("PixelmonMovePP" + slot);
|
||||
compound.removeTag("PixelmonMovePPBase" + slot);
|
||||
if (id < 0) {
|
||||
compound.removeTag("PixelmonMoveID" + slot);
|
||||
} else {
|
||||
compound.setInteger("PixelmonMoveID" + slot, id);
|
||||
}
|
||||
int size = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (compound.hasKey("PixelmonMoveID" + i))
|
||||
size++;
|
||||
}
|
||||
compound.setInteger("PixelmonNumberMoves", size);
|
||||
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
pixelmon.readEntityFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
public int getType() {
|
||||
return EntityType.PIXELMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type){
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.PIXELMON || super.typeOf(type);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -23,7 +23,7 @@ public class ScriptProjectile<T extends EntityProjectile> extends ScriptEntity<T
|
||||
}
|
||||
|
||||
public void setItem(IItemStack item) {
|
||||
if(item == null)
|
||||
if (item == null)
|
||||
entity.setThrownItem(null);
|
||||
else
|
||||
entity.setThrownItem(item.getMCItemStack());
|
||||
@@ -46,7 +46,7 @@ public class ScriptProjectile<T extends EntityProjectile> extends ScriptEntity<T
|
||||
}
|
||||
|
||||
public void setHeading(IEntity entity) {
|
||||
setHeading(entity.getX(), entity.getMCEntity().boundingBox.minY + (double)(entity.getHeight() / 2.0F), entity.getZ());
|
||||
setHeading(entity.getX(), entity.getMCEntity().boundingBox.minY + (double) (entity.getHeight() / 2.0F), entity.getZ());
|
||||
}
|
||||
|
||||
public void setHeading(double x, double y, double z) {
|
||||
@@ -63,9 +63,9 @@ public class ScriptProjectile<T extends EntityProjectile> extends ScriptEntity<T
|
||||
entity.prevRotationYaw = entity.rotationYaw = yaw;
|
||||
entity.prevRotationPitch = entity.rotationPitch = pitch;
|
||||
|
||||
double varX = (double)(-MathHelper.sin(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(pitch / 180.0F * (float)Math.PI));
|
||||
double varZ = (double)(MathHelper.cos(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(pitch / 180.0F * (float)Math.PI));
|
||||
double varY = (double)(-MathHelper.sin(pitch / 180.0F * (float)Math.PI));
|
||||
double varX = (double) (-MathHelper.sin(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI));
|
||||
double varZ = (double) (MathHelper.cos(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI));
|
||||
double varY = (double) (-MathHelper.sin(pitch / 180.0F * (float) Math.PI));
|
||||
|
||||
float acc = (float) (20.0F - Math.floor(entity.accuracy / 5.0F));
|
||||
entity.setThrowableHeading(varX, varY, varZ, -pitch, acc);
|
||||
@@ -75,7 +75,7 @@ public class ScriptProjectile<T extends EntityProjectile> extends ScriptEntity<T
|
||||
return EntityType.PROJECTILE;
|
||||
}
|
||||
|
||||
public boolean typeOf(int type){
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.PROJECTILE || super.typeOf(type);
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ public class ScriptProjectile<T extends EntityProjectile> extends ScriptEntity<T
|
||||
}
|
||||
|
||||
public void enableEvents() {
|
||||
if(ScriptContainer.Current == null)
|
||||
if (ScriptContainer.Current == null)
|
||||
throw new CustomNPCsException("Can only be called during scripts");
|
||||
|
||||
if(!entity.scripts.contains(ScriptContainer.Current)) {
|
||||
if (!entity.scripts.contains(ScriptContainer.Current)) {
|
||||
entity.scripts.add(ScriptContainer.Current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptVillager<T extends EntityVillager> extends ScriptLiving<T> implements IVillager {
|
||||
|
||||
public ScriptVillager(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
public ScriptVillager(T entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProfession() {
|
||||
@@ -23,18 +23,17 @@ public class ScriptVillager<T extends EntityVillager> extends ScriptLiving<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingBase getCustomer()
|
||||
{
|
||||
public IEntityLivingBase getCustomer() {
|
||||
return (IEntityLivingBase) NpcAPI.Instance().getPlayer(entity.getCustomer().getCommandSenderName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(){
|
||||
return EntityType.VILLAGER;
|
||||
}
|
||||
@Override
|
||||
public int getType() {
|
||||
return EntityType.VILLAGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type){
|
||||
public boolean typeOf(int type) {
|
||||
return type == EntityType.VILLAGER || super.typeOf(type);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user