Updated interfaces to have the proper functions. Documentation will focus around them, so they'll be better organized from now on.

This commit is contained in:
Luis C.M committed 2022-05-11 16:31:14 -05:00
1 parent aab550cdca
commit c2546c3f82
22 files changed
+801 -355

No files matched your search

@@ -9,10 +9,7 @@ import com.ibm.icu.text.ArabicShaping;
import com.ibm.icu.text.ArabicShapingException;
import com.ibm.icu.text.Bidi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiLabel;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.custom.GuiCustom;
@@ -25,7 +22,6 @@ import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
public class CustomGuiLabel extends Gui implements IGuiComponent {
int x, y, width, height;
@@ -135,14 +131,14 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
}
public static CustomGuiLabel fromComponent(ScriptGuiLabel component) {
CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.hasShadow());
CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.getShadow());
lbl.scale = 1.0F;
lbl.color = component.getColor();
lbl.setScale(component.getScale());
if (component.hasHoverText()) {
lbl.hoverText = component.getHoverText();
}
lbl.labelShadowEnabled = component.hasShadow();
lbl.labelShadowEnabled = component.getShadow();
lbl.color = component.getColor();
lbl.alpha = component.getAlpha();
lbl.rotation = component.getRotation();
@@ -155,7 +151,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
public ICustomGuiComponent toComponent() {
ScriptGuiLabel component = new ScriptGuiLabel(this.id, this.fullLabel, this.field_146162_g, this.field_146174_h, this.field_146167_a, this.field_146161_f, this.color);
component.setHoverText(this.hoverText);
component.enableShadow(this.labelShadowEnabled);
component.setShadow(this.labelShadowEnabled);
component.setColor(this.color);
component.setAlpha(this.alpha);
component.setRotation(this.rotation);
@@ -200,6 +200,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
entityID, entity.dimension
);
}
public void spawnParticle(ScriptParticle entityParticle) { entityParticle.spawnOnEntity(this); }
public int getEntityId(){
@@ -357,6 +358,10 @@ public class ScriptEntity<T extends Entity> implements IEntity {
this.entity.setPosition((double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F));
}
public int getDimension(){
return entity.dimension;
}
/**
* @param range The search range for entities around this entity
* @return Array of entities within range
@@ -317,6 +317,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return new ScriptRoleTransporter(npc);
return new ScriptRoleInterface(npc);
}
public void setRole(int role){
for (EnumRoleType e : EnumRoleType.values()) {
if (e.ordinal() == role) {
@@ -348,6 +349,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return new ScriptJobSpawner(npc);
return new ScriptJobInterface(npc);
}
public void setJob(int job){
for (EnumJobType e : EnumJobType.values()) {
if (e.ordinal() == job) {
@@ -449,6 +449,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
}
@Deprecated
public boolean checkGUIOpen() {
NoppesUtilPlayer.isGUIOpen(player);
PlayerData data = PlayerDataController.instance.getPlayerData(player);
@@ -20,7 +20,7 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
this.setText(label);
this.setPos(x, y);
this.setSize(width, height);
this.enableShadow(false);
this.setShadow(false);
}
public ScriptGuiLabel(int id, String label, int x, int y, int width, int height, int color) {
@@ -60,11 +60,11 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
return this;
}
public boolean hasShadow(){
public boolean getShadow(){
return this.shadow;
}
public void enableShadow(boolean shadow){
public void setShadow(boolean shadow){
this.shadow = shadow;
}
@@ -86,7 +86,7 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
this.setText(nbt.getString("label"));
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
this.setScale(nbt.getFloat("scale"));
this.enableShadow(nbt.getBoolean("shadow"));
this.setShadow(nbt.getBoolean("shadow"));
return this;
}
}
@@ -6,7 +6,10 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptTileEntity;
public interface IBlock {
int getX();
@@ -33,9 +36,17 @@ public interface IBlock {
IWorld getWorld();
boolean hasTileEntity();
ScriptTileEntity getTileEntity();
void setTileEntity(ScriptTileEntity tileEntity);
TileEntity getMCTileEntity();
Block getMCBlock();
String getDisplayName();
INbt getTileEntityNBT();
}
@@ -5,6 +5,8 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
import java.util.List;
public interface ICustomGui {
@@ -61,4 +63,14 @@ public interface ICustomGui {
void updateComponent(ICustomGuiComponent var1);
void update(IPlayer var1);
boolean getShowPlayerInv();
int getPlayerInvX();
int getPlayerInvY();
ICustomGui fromNBT(NBTTagCompound tag);
NBTTagCompound toNBT();
}
@@ -5,6 +5,9 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.gui.ScriptGuiComponent;
public interface ICustomGuiComponent {
int getID();
@@ -23,4 +26,20 @@ public interface ICustomGuiComponent {
ICustomGuiComponent setHoverText(String var1);
ICustomGuiComponent setHoverText(String[] var1);
int getColor();
ICustomGuiComponent setColor(int color);
float getAlpha();
void setAlpha(float alpha);
float getRotation();
void setRotation(float rotation);
NBTTagCompound toNBT(NBTTagCompound nbt);
ScriptGuiComponent fromNBT(NBTTagCompound nbt);
}
@@ -1,10 +1,22 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
public interface ICustomItem extends IItemStack {
String getTexture();
void setTexture(String var2);
int getArmorType();
void setIsTool(boolean isTool);
boolean isTool();
void setDigSpeed(int digSpeed);
int getDigSpeed();
void setMaxStackSize(int var1);
double getDurabilityValue();
@@ -22,4 +34,72 @@ public interface ICustomItem extends IItemStack {
int getColor();
void setColor(int var1);
int getMaxItemUseDuration();
void setMaxItemUseDuration(int duration);
void setItemUseAction(int action);
int getItemUseAction();
int getEnchantability();
void setEnchantability(int enchantability);
void setRotation(float rotationX, float rotationY, float rotationZ);
void setRotationRate(float rotationXRate, float rotationYRate, float rotationZRate);
void setScale(float scaleX, float scaleY, float scaleZ);
void setTranslate(float translateX, float translateY, float translateZ);
void setRotationX(float rotationX);
void setRotationY(float rotationY);
void setRotationZ(float rotationZ);
void setRotationXRate(float rotationXRate);
void setRotationYRate(float rotationYRate);
void setRotationZRate(float rotationZRate);
void setScaleX(float scaleX);
void setScaleY(float scaleY);
void setScaleZ(float scaleZ);
void setTranslateX(float translateX);
void setTranslateY(float translateY);
void setTranslateZ(float translateZ);
float getRotationX();
float getRotationY();
float getRotationZ();
float getRotationXRate();
float getRotationYRate();
float getRotationZRate();
float getScaleX();
float getScaleY();
float getScaleZ();
float getTranslateX();
float getTranslateY();
float getTranslateZ();
}
@@ -16,337 +16,346 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @return Returns the current npcs size 1-30
*/
public int getSize();
int getSize();
/**
* @param size The size of the npc (1-30) default is 5
*/
public void setSize(int size);
void setSize(int size);
/**
* @return Returns the current npcs modelType of the NPC
*/
public int getModelType();
int getModelType();
/**
* @param modelType The modelType of the NPC. 0: Steve, 1: Steve64, 2: Alex
*/
public void setModelType(int modelType);
void setModelType(int modelType);
/**
* @return The npcs name
*/
public String getName();
String getName();
public void setRotation(float rotation);
void setRotation(float rotation);
void setRotationType(int rotationType);
int getRotationType();
/**
* @param name The name of the npc
*/
public void setName(String name);
void setName(String name);
/**
* @since 1.7.10
* @return The npcs title
*/
public String getTitle();
String getTitle();
/**
* @since 1.7.10
* @param title The title of the npc
*/
public void setTitle(String title);
void setTitle(String title);
/**
* @return The npcs texture
*/
public String getTexture();
String getTexture();
/**
* @param texture The texture of the npc
*/
public void setTexture(String texture);
void setTexture(String texture);
/**
* @return Home position x
*/
public int getHomeX();
int getHomeX();
/**
* @param x The home x position
*/
public void setHomeX(int x);
void setHomeX(int x);
/**
* @return Home position x
*/
public int getHomeY();
int getHomeY();
/**
* @param y The home y position
*/
public void setHomeY(int y);
void setHomeY(int y);
/**
* @return Home position x
*/
public int getHomeZ();
int getHomeZ();
/**
* @param z The home x position
*/
public void setHomeZ(int z);
void setHomeZ(int z);
/**
* @param x The home x position
* @param y The home y position
* @param z The home z position
*/
public void setHome(int x, int y, int z);
void setHome(int x, int y, int z);
/**
* @param health New max health
*/
public void setMaxHealth(double health);
void setMaxHealth(double health);
/**
* @param bo Whether or not the npc will try to return to his home position
*/
public void setReturnToHome(boolean bo);
void setReturnToHome(boolean bo);
/**
* @return Whether or not the npc returns home
*/
public boolean getReturnToHome();
boolean getReturnToHome();
/**
* @return The faction of the npc
*/
public ScriptFaction getFaction();
ScriptFaction getFaction();
/**
* @param id The id of the new faction
*/
public void setFaction(int id);
void setFaction(int id);
/**
*
* @param attackOtherFactions True if you want the NPC to attack other factions, false otherwise.
*/
public void setAttackFactions(boolean attackOtherFactions);
void setAttackFactions(boolean attackOtherFactions);
/**
*
* @return Returns true if the NPC attacks other factions, false otherwise.
*/
public boolean getAttackFactions();
boolean getAttackFactions();
/**
*
* @param defendFaction True if the NPC should defend faction members, false otherwise.
*/
public void setDefendFaction(boolean defendFaction);
void setDefendFaction(boolean defendFaction);
/**
*
* @return Returns true if the NPC should defend faction members, false otherwise.
*/
public boolean getDefendFaction();
boolean getDefendFaction();
public int getType();
int getType();
public boolean typeOf(int type);
boolean typeOf(int type);
/**
* @param target The targeted npc
* @param item The item you want to shoot
* @param accuracy Accuracy of the shot (0-100)
*/
public void shootItem(ScriptLivingBase target, ScriptItemStack item, int accuracy);
void shootItem(ScriptLivingBase target, ScriptItemStack item, int accuracy);
/**
* @param message The message the npc will say
*/
public void say(String message);
void say(String message);
/**
* @param message The message the npc will say
*/
public void say(ScriptPlayer player, String message);
void say(ScriptPlayer player, String message);
/**
* Kill the npc, doesnt't despawn it
*/
public void kill();
void kill();
/**
* Basically completely resets the npc. This will also call the Init script
*/
public void reset();
void reset();
/**
* @return Returns the npcs current role
*/
public ScriptRoleInterface getRole();
ScriptRoleInterface getRole();
void setRole(int role);
/**
* @return Returns the npcs current job
*/
public ScriptJobInterface getJob();
ScriptJobInterface getJob();
void setJob(int job);
/**
* @return The item held in the right hand
*/
public IItemStack getRightItem();
IItemStack getRightItem();
/**
* @param item Item to be held in the right hand
*/
public void setRightItem(ScriptItemStack item);
void setRightItem(ScriptItemStack item);
/**
* @return The item held in the left hand
*/
public IItemStack getLefttItem();
IItemStack getLefttItem();
/**
* @param item Item to be held in the left hand
*/
public void setLeftItem(ScriptItemStack item);
void setLeftItem(ScriptItemStack item);
/**
* @return Returns the projectile the npc uses
*/
public IItemStack getProjectileItem();
IItemStack getProjectileItem();
/**
* @param item Item to be used as projectile
*/
public void setProjectileItem(ScriptItemStack item);
void setProjectileItem(ScriptItemStack item);
/**
*
* @return Returns true if the NPC can aim while shooting.
*/
public boolean canAimWhileShooting();
boolean canAimWhileShooting();
/**
*
* @param aimWhileShooting Set to true if you want the NPC to aim while shooting, false otherwise.
*/
public void aimWhileShooting(boolean aimWhileShooting);
void aimWhileShooting(boolean aimWhileShooting);
public void setMinProjectileDelay(int minDelay);
public int getMinProjectileDelay();
void setMinProjectileDelay(int minDelay);
int getMinProjectileDelay();
public void setMaxProjectileDelay(int maxDelay);
public int getMaxProjectileDelay();
void setMaxProjectileDelay(int maxDelay);
int getMaxProjectileDelay();
public void setRangedRage(int rangedRange);
public int getRangedRage();
void setRangedRage(int rangedRange);
int getRangedRage();
public void setFireRate(int rate);
public int getFireRate();
void setFireRate(int rate);
int getFireRate();
public void setBurstCount(int burstCount);
public int getBurstCount();
void setBurstCount(int burstCount);
int getBurstCount();
public void setShotCount(int shotCount);
public int getShotCount();
void setShotCount(int shotCount);
int getShotCount();
public void setAccuracy(int accuracy);
public int getAccuracy();
void setAccuracy(int accuracy);
int getAccuracy();
/**
*
* @return The directory of the sound that plays when a projectile is shot
*/
public String getFireSound();
String getFireSound();
/**
*
* @param fireSound The new directory of the sound that plays when a projectile is shot
*/
public void setFireSound(String fireSound);
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
*/
public IItemStack getArmor(int slot);
IItemStack getArmor(int slot);
/**
* @param slot The armor slot to set. 0:head, 1:body, 2:legs, 3:boots
* @param item Item to be set as armor
*/
public void setArmor(int slot, ScriptItemStack item);
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 IItemStack getLootItem(int slot);
IItemStack 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);
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 double getLootChance(int slot);
double 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, double chance);
void setLootChance(int slot, double chance);
/**
*
* @return The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
*/
public int getLootMode();
int getLootMode();
/**
*
* @param lootMode The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
*/
public void setLootMode(int lootMode);
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);
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);
void setMaxLootXP(int lootXP);
/**
*
* @return The minimum XP gained from killing the NPC.
*/
public int getMinLootXP();
int getMinLootXP();
/**
*
* @return The maximum XP gained from killing the NPC.
*/
public int getMaxLootXP();
int getMaxLootXP();
/**
* @param type The AnimationType
*/
public void setAnimation(int type);
void setAnimation(int type);
/**
*
@@ -360,7 +369,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 6 - None
*
*/
public void setTacticalVariant(int variant);
void setTacticalVariant(int variant);
/**
*
@@ -374,43 +383,43 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 6 - None
*
*/
public int getTacticalVariant();
int getTacticalVariant();
/**
*
* @param variant Sets the NPC's tactical variant by name.
*/
public void setTacticalVariant(String variant);
void setTacticalVariant(String variant);
/**
*
* @return Returns the name of the NPc's tactical variant.
*/
public String getTacticalVariantName();
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);
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();
int getTacticalRadius();
/**
*
* @param ignore True if the NPC goes through cobwebs
*/
public void setIgnoreCobweb(boolean ignore);
void setIgnoreCobweb(boolean ignore);
/**
*
* @return True if the NPC goes through cobwebs
*/
public boolean getIgnoreCobweb();
boolean getIgnoreCobweb();
/**
*
@@ -420,7 +429,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 2 - Retreat
* 3 - Nothing
*/
public void setOnFoundEnemy(int onAttack);
void setOnFoundEnemy(int onAttack);
/**
*
@@ -430,7 +439,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 2 - Retreat
* 3 - Nothing
*/
public int onFoundEnemy();
int onFoundEnemy();
/**
*
@@ -439,7 +448,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 1 - Sunlight
* 2 - Disabled
*/
public void setShelterFrom(int shelterFrom);
void setShelterFrom(int shelterFrom);
/**
*
@@ -448,36 +457,36 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 1 - Sunlight
* 2 - Disabled
*/
public int getShelterFrom();
int getShelterFrom();
/**
*
* @return Whether the NPC has a living animation
*/
public boolean hasLivingAnimation();
boolean hasLivingAnimation();
/**
*
* @param livingAnimation True if you want the NPC to have a living animation, false otherwise
*/
public void setLivingAnimation(boolean livingAnimation);
void setLivingAnimation(boolean livingAnimation);
/**
* @param type The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible
*/
public void setVisibleType(int type);
void setVisibleType(int type);
/**
* @return The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible
*/
public int getVisibleType();
int getVisibleType();
/**
*
* @param player The player this NPC becomes visible/invisible to
* @param visible True if you want the NPC to be invisible to the player, false otherwise
*/
public void setVisibleTo(ScriptPlayer player, boolean visible);
void setVisibleTo(ScriptPlayer player, boolean visible);
/**
*
@@ -486,251 +495,253 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* If setVisibleTo(player,visible) was not called to make this NPC invisible to the player at any point
* in the NPC's life, this function will return true regardless of the value of isVisible().
*/
public boolean isVisibleTo(ScriptPlayer player);
boolean isVisibleTo(ScriptPlayer player);
/**
* @param type The visibility type of the name, 0:visible, 1:invisible, 2:when-attacking
*/
public void setShowName(int type);
void setShowName(int type);
/**
* @return Returns the visibility type of the name, 0:visible, 1:invisible, 2:when-attacking
*/
public int getShowName();
int getShowName();
/**
* @return Returns the visiblity of the boss bar, 0:invisible, 1:visible, 2:when-attacking
*/
public int getShowBossBar();
int getShowBossBar();
/**
* @param type The visibility type of the boss bar, 0:invisible, 1:visible, 2:when-attacking
*/
public void setShowBossBar(int type);
void setShowBossBar(int type);
/**
* @return The melee strength
*/
public float getMeleeStrength();
float getMeleeStrength();
/**
* @param strength The melee strength
*/
public void setMeleeStrength(float strength);
void setMeleeStrength(float strength);
/**
* @return The melee speed
*/
public int getMeleeSpeed();
int getMeleeSpeed();
/**
* @param speed The melee speed
*/
public void setMeleeSpeed(int speed);
void setMeleeSpeed(int speed);
/**
* @return The ranged strength
*/
public float getRangedStrength();
float getRangedStrength();
/**
* @param strength The ranged strength
*/
public void setRangedStrength(float strength);
void setRangedStrength(float strength);
/**
* @return The ranged speed
*/
public int getRangedSpeed();
int getRangedSpeed();
/**
* @param speed The ranged speed
*/
public void setRangedSpeed(int speed);
void setRangedSpeed(int speed);
/**
* @return The ranged burst count
*/
public int getRangedBurst();
int getRangedBurst();
/**
* @param count The ranged burst count
*/
public void setRangedBurst(int count);
void setRangedBurst(int count);
/**
*
* @return The amount of ticks before this entity respawns
*/
public int getRespawnTime();
int getRespawnTime();
/**
*
* @param time The new amount of ticks before this entity respawns
*/
public void setRespawnTime(int time);
void setRespawnTime(int time);
/**
*
* @return Respawn: 0 - Yes (Always), 1 - Day, 2 - Night, 3 - No (Dies permanently)
*/
public int getRespawnCycle();
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);
void setRespawnCycle(int cycle);
/**
*
* @return Whether the NPC is hidden when it dies
*/
public boolean getHideKilledBody();
boolean getHideKilledBody();
/**
*
* @param hide True if the NPC is hidden when it dies. False otherwise.
*/
public void hideKilledBody(boolean hide);
void hideKilledBody(boolean hide);
/**
*
* @return Returns true if the NPC naturally despawns.
*/
public boolean naturallyDespawns();
boolean naturallyDespawns();
/**
*
* @param canDespawn True if the NPC should naturally despawn. False otherwise.
*/
public void setNaturallyDespawns(boolean canDespawn);
void setNaturallyDespawns(boolean canDespawn);
/**
* @param player The player to give the item to
* @param item The item given to the player
*/
public void giveItem(ScriptPlayer player, ScriptItemStack item);
void giveItem(ScriptPlayer player, ScriptItemStack 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);
void executeCommand(String command);
public void setHeadScale(float x, float y, float z);
void setHeadScale(float x, float y, float z);
public void setBodyScale(float x, float y, float z);
void setBodyScale(float x, float y, float z);
public void setArmsScale(float x, float y, float z);
void setArmsScale(float x, float y, float z);
public void setLegsScale(float x, float y, float z);
void setLegsScale(float x, float y, float z);
/**
* @since 1.7.10c
* @param resistance Explosion resistance (0-2) default is 1
*/
public void setExplosionResistance(float resistance);
void setExplosionResistance(float resistance);
/**
* @since 1.7.10c
* @return Returns Explosion Resistance
*/
public float getExplosionResistance();
float getExplosionResistance();
/**
* @param resistance Melee resistance (0-2) default is 1
*/
public void setMeleeResistance(float resistance);
void setMeleeResistance(float resistance);
/**
* @return Returns Melee Resistance
*/
public float getMeleeResistance();
float getMeleeResistance();
/**
* @param resistance Arrow resistance (0-2) default is 1
*/
public void setArrowResistance(float resistance);
void setArrowResistance(float resistance);
/**
* @return Returns Arrow Resistance
*/
public float getArrowResistance();
float getArrowResistance();
/**
* @param resistance Knockback resistance (0-2) default is 1
*/
public void setKnockbackResistance(float resistance);
void setKnockbackResistance(float resistance);
/**
* @return Returns Knockback Resistance
*/
public float getKnockbackResistance();
float getKnockbackResistance();
/**
* @param type Retaliation type. 0:normal, 1:panic, 2:retreat, 3:nothing
*/
public void setRetaliateType(int type);
void setRetaliateType(int type);
/**
* @return Returns the combat health regen per second
*/
public float getCombatRegen();
float getCombatRegen();
/**
* @param regen The combat health regen per second
*/
public void setCombatRegen(float regen);
void setCombatRegen(float regen);
/**
* @return Returns the health regen per second when not in combat
*/
public float getHealthRegen();
float getHealthRegen();
/**
* @param regen The health regen per second when not in combat
*/
public void setHealthRegen(float regen);
void setHealthRegen(float regen);
public long getAge();
long getAge();
public void setFly(int fly);
ITimers getTimers();
public boolean canFly();
void setFly(int fly);
public void setFlySpeed(double flySpeed);
boolean canFly();
public double getFlySpeed(double flySpeed);
void setFlySpeed(double flySpeed);
public void setFlyGravity(double flyGravity);
double getFlySpeed(double flySpeed);
public double getFlyGravity(double flyGravity);
void setFlyGravity(double flyGravity);
public void setSpeed(int speed);
double getFlyGravity(double flyGravity);
public int getSpeed();
void setSpeed(int speed);
public void setSkinType(byte type);
int getSpeed();
public byte getSkinType();
void setSkinType(byte type);
public void setSkinUrl(String url);
byte getSkinType();
public String getSkinUrl();
void setSkinUrl(String url);
public void setCloakTexture(String cloakTexture);
String getSkinUrl();
public String getCloakTexture();
void setCloakTexture(String cloakTexture);
public void setOverlayTexture(String overlayTexture);
String getCloakTexture();
public String getOverlayTexture();
void setOverlayTexture(String overlayTexture);
public void setCollisionType(int type);
String getOverlayTexture();
public int getCollisionType();
void setCollisionType(int type);
public void updateClient();
int getCollisionType();
void updateClient();
}
@@ -1,4 +1,38 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
import java.util.List;
public interface ICustomOverlay {
int getID();
List<ICustomOverlayComponent> getComponents();
int getDefaultAlignment();
void setDefaultAlignment(int defaultAlignment);
IOverlayTexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height);
IOverlayTexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY);
IOverlayLabel addLabel(int id, String label, int x, int y, int width, int height);
IOverlayLabel addLabel(int id, String label, int x, int y, int width, int height, int color);
IOverlayLine addLine(int id, int x1, int y1, int x2, int y2, int color, int thickness);
IOverlayLine addLine(int id, int x1, int y1, int x2, int y2);
ICustomOverlayComponent getComponent(int componentID);
void removeComponent(int componentID);
void updateComponent(ICustomOverlayComponent component);
void update(IPlayer player);
ICustomOverlay fromNBT(NBTTagCompound tag);
NBTTagCompound toNBT();
}
@@ -1,5 +1,8 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.overlay.ScriptOverlayComponent;
public interface ICustomOverlayComponent {
int getID();
@@ -26,4 +29,8 @@ public interface ICustomOverlayComponent {
float getRotation();
void setRotation(float rotation);
NBTTagCompound toNBT(NBTTagCompound nbt);
ScriptOverlayComponent fromNBT(NBTTagCompound nbt);
}
@@ -10,6 +10,8 @@ import net.minecraft.util.DamageSource;
public interface IDamageSource {
String getType();
boolean isUnblockable();
boolean isProjectile();
IEntity getTrueSource();
@@ -6,274 +6,344 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptBlockPos;
import noppes.npcs.scripted.ScriptParticle;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.item.ScriptItemStack;
public interface IEntity<T extends Entity> {
public double getYOffset();
void spawnParticle(ScriptParticle entityParticle);
int getEntityId();
String getUniqueID();
double getYOffset();
/**
* @return The entities width
*/
public double getWidth();
double getWidth();
/**
* @return The entities height
*/
public double getHeight();
double getHeight();
/**
* @return The entities x position
*/
public double getX();
double getX();
/**
* @param x The entities x position
*/
public void setX(double x);
void setX(double x);
/**
* @return The entities y position
*/
public double getY();
double getY();
/**
* @param y The entities y position
*/
public void setY(double y);
void setY(double y);
/**
* @return The entities x position
*/
public double getZ();
double getZ();
/**
* @param z The entities x position
*/
public void setZ(double z);
void setZ(double z);
/**
* @return The entities z motion
*/
double getMotionX();
/**
* @param x The entities x motion
*/
void setMotionX(double x);
/**
* @return The entities x motion
*/
double getMotionY();
/**
* @param y The entities y motion
*/
void setMotionY(double y);
/**
* @return The entities y motion
*/
double getMotionZ();
/**
* @param z The entities z motion
*/
void setMotionZ(double z);
void setMotion(double x, double y, double z);
boolean isAirborne();
/**
* @return The block x position
*/
public int getBlockX();
int getBlockX();
/**
* @return The block y position
*/
public int getBlockY();
int getBlockY();
/**
* @return The block z position
*/
public int getBlockZ();
int getBlockZ();
/**
* @param x The x position
* @param y The y position
* @param z The z position
*/
public void setPosition(double x, double y, double z);
void setPosition(double x, double y, double z);
IPos getPos();
void setPos(IPos pos);
int getDimension();
/**
* @param range The search range for entities around this entity
* @return Array of entities within range
*/
public ScriptEntity[] getSurroundingEntities(int range);
ScriptEntity[] getSurroundingEntities(int range);
/**
* @param range The search range for entities around this entity
* @param type The EntityType you want to find
* @return Array of entities within range
*/
public ScriptEntity[] getSurroundingEntities(int range, int type);
ScriptEntity[] getSurroundingEntities(int range, int type);
/**
* @return Whether the entity is alive or not
*/
public boolean isAlive();
boolean isAlive();
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
public Object getTempData(String key);
Object getTempData(String key);
/**
* Tempdata gets cleared when the entity gets unloaded or the world restarts
* @param key The key for the data stored
* @param value The data stored
*/
public void setTempData(String key, Object value);
void setTempData(String key, Object value);
/**
* @param key The key thats going to be tested against the temp data
* @return Whether or not temp data containes the key
*/
public boolean hasTempData(String key);
boolean hasTempData(String key);
/**
* @param key The key for the temp data to be removed
*/
public void removeTempData(String key);
void removeTempData(String key);
/**
* Remove all tempdata
*/
public void clearTempData();
void clearTempData();
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
public Object getStoredData(String key);
Object getStoredData(String key);
/**
* Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved
* @param key The key for the data stored
* @param value The data stored. This data can be either a Number or a String. Other data is not stored
*/
public void setStoredData(String key, Object value);
void setStoredData(String key, Object value);
/**
* @param key The key of the data to be checked
* @return Returns whether or not the stored data contains the key
*/
public boolean hasStoredData(String key);
boolean hasStoredData(String key);
/**
* @param key The key of the data to be removed
*/
public void removeStoredData(String key);
void removeStoredData(String key);
/**
* Remove all stored data
*/
public void clearStoredData();
void clearStoredData();
/**
* @return The age of this entity in ticks
*/
public long getAge();
long getAge();
/**
* Despawns this entity. Removes it permanently
*/
public void despawn();
void despawn();
/**
* @return Return whether or not this entity is standing in water
*/
public boolean inWater();
boolean inWater();
/**
* @return Return whether or not this entity is standing in lava
*/
public boolean inLava();
boolean inLava();
/**
* @return Return whether or not this entity is standing in fire
*/
public boolean inFire();
boolean inFire();
/**
* @return Return whether or not this entity is on fire
*/
public boolean isBurning();
boolean isBurning();
/**
* @param ticks Amount of world ticks this entity will burn. 20 ticks equals 1 second
*/
public void setBurning(int ticks);
void setBurning(int ticks);
/**
* Removes fire from this entity
*/
public void extinguish();
void extinguish();
/**
* @return Name as which it's registered in minecraft
*/
public String getTypeName();
String getTypeName();
/**
* @param item Item to be dropped
*/
public void dropItem(ScriptItemStack item);
void dropItem(ScriptItemStack item);
/**
* @return Return the rider
*/
public ScriptEntity getRider();
ScriptEntity getRider();
/**
* @param entity The entity to ride this entity
*/
public void setRider(ScriptEntity entity);
void setRider(ScriptEntity entity);
/**
* @return Return the entity, this entity is riding
*/
public ScriptEntity getMount();
ScriptEntity getMount();
/**
* @param entity The entity this entity will mount
*/
public void setMount(ScriptEntity entity);
void setMount(ScriptEntity entity);
/**
* @see noppes.npcs.scripted.constants.EntityType
* @return Returns the EntityType of this entity
*/
public int getType();
int getType();
/**
* @since 1.7.10c
* @param type @EntityType to check
* @return Returns whether the entity is type of the given @EntityType
*/
public boolean typeOf(int type);
boolean typeOf(int type);
/**
* @param rotation The rotation to be set (0-360)
*/
public void setRotation(float rotation);
void setRotation(float rotation);
/**
* @return Current rotation of the npc
*/
public float getRotation();
float getRotation();
public void setPitch(float pitch);
public float getPitch();
/**
* @param power How strong the knockback is
* @param direction The direction in which he flies back (0-360). Usually based on getRotation()
*/
public void knockback(int power, float direction);
void knockback(int power, float direction);
public void knockback(int xpower, int ypower, int zpower, float direction);
void knockback(int xpower, int ypower, int zpower, float direction);
public void setImmune(int ticks);
void setImmune(int ticks);
public boolean hasCollided();
public void setInvisible(boolean invisible);
public void setSneaking(boolean sneaking);
public void setSprinting(boolean sprinting);
boolean hasCollided();
/**
* @since 1.7.10c
* @return Returns whether or not this entity is sneaking
*/
public boolean isSneaking();
boolean isSneaking();
/**
* @since 1.7.10c
* @return Returns whether or not this entity is sprinting
*/
public boolean isSprinting();
boolean isSprinting();
/**
* @since 1.7.10c
* Expert users only
* @return Returns minecrafts entity
*/
public T getMCEntity();
T getMCEntity();
public INbt getNbt();
public INbt getAllNbt();
public void setNbt(INbt nbt);
void storeAsClone(int tab, String name);
ScriptWorld getWorld();
}
@@ -1,60 +1,69 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.wrapper.ScriptDamageSource;
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
/**
* @return The entity's current health
*/
public float getHealth();
float getHealth();
/**
* @param health The new health of this entity
*/
public void setHealth(float health);
void setHealth(float health);
void hurt(float damage);
void hurt(float damage, ScriptEntity source);
void hurt(float damage, ScriptDamageSource damageSource);
/**
* @return Entity's max health
*/
public double getMaxHealth();
double getMaxHealth();
/**
* @return Whether or not this entity is attacking something
*/
public boolean isAttacking();
boolean isAttacking();
/**
* @param living Entity which this entity will attack
*/
public void setAttackTarget(ScriptLivingBase living);
void setAttackTarget(ScriptLivingBase living);
/**
* @return The entity which this entity is attacking
*/
public ScriptLivingBase getAttackTarget();
ScriptLivingBase getAttackTarget();
public int getType();
int getType();
public boolean typeOf(int type);
boolean typeOf(int type);
/**
* @param entity Entity to check
* @return Whether or not this entity can see the given entity
*/
public boolean canSeeEntity(ScriptEntity entity);
boolean canSeeEntity(ScriptEntity entity);
/**
* Expert use only
* @return Returns the minecraft entity object
*/
public T getMCEntity();
T getMCEntity();
/**
* Makes the entity swing its hand
*/
public void swingHand();
void swingHand();
/**
* Works the same as the <a href="http://minecraft.gamepedia.com/Commands#effect">/effect command</a>
@@ -63,40 +72,40 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @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);
void addPotionEffect(int effect, int duration, int strength, boolean hideParticles);
/**
* Clears all potion effects
*/
public void clearPotionEffects();
void clearPotionEffects();
/**
* @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);
int getPotionEffect(int effect);
/**
* Note not all Living Entities support this
* @since 1.7.10c
* @return The item the entity is holding
*/
public IItemStack getHeldItem();
IItemStack getHeldItem();
/**
* Note not all Living Entities support this
* @since 1.7.10c
* @param item The item to be set
*/
public void setHeldItem(ScriptItemStack item);
void setHeldItem(ScriptItemStack item);
/**
* 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);
IItemStack getArmor(int slot);
/**
* Note not all Living Entities support this
@@ -104,5 +113,5 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @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, ScriptItemStack item);
void setArmor(int slot, ScriptItemStack item);
}
@@ -1,115 +1,145 @@
package noppes.npcs.scripted.interfaces;
import com.google.common.collect.Multimap;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public interface IItemStack {
public String getName();
String getName();
/**
* @return Returns the stacksize
*/
public int getStackSize();
int getStackSize();
/**
* @return Return whether or not the item has a custom name
*/
public boolean hasCustomName();
boolean hasCustomName();
/**
* @param name The custom name this item will get
*/
public void setCustomName(String name);
void setCustomName(String name);
/**
* @return Return the ingame displayed name. This is either the item name or the custom name if it has one.
*/
public String getDisplayName();
String getDisplayName();
/**
* @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
*/
public String getItemName();
String getItemName();
/**
* @param size The size of the itemstack. A number between 1 and 64
*/
public void setStackSize(int size);
void setStackSize(int size);
int getMaxStackSize();
/**
* @return Returns the item damage of this item. For tools this is the durability for other items the color and more.
*/
public int getItemDamage();
int getItemDamage();
/**
* @param value The value to be set as item damage. For tools this is the durability for other items the color and more.
*/
public void setItemDamage(int value);
void setItemDamage(int value);
/**
* @param key The key of this NBTTag
* @param value The value to be stored. Can be a Number or String
*/
public void setTag(String key, Object value);
void setTag(String key, Object value);
/**
* @param key The key of the NBTTag
* @return Returns whether or not the key exists
*/
public boolean hasTag(String key);
boolean hasTag(String key);
/**
* @param key The key of the NBTTag
* @return Returns the value associated with the key. Returns null of it doesnt exist
*/
public Object getTag(String key);
Object getTag(String key);
public INbt removeTags();
INbt removeTags();
public boolean isEnchanted();
boolean isEnchanted();
/**
* @since 1.7.10d
* @param id The enchantment id
* @return
*/
public boolean hasEnchant(int id);
boolean hasEnchant(int id);
void addEnchant(int id, int strength);
void setAttribute(String name, double value);
double getAttribute(String name);
String[] getLore();
boolean hasLore();
void setLore(String[] lore);
boolean hasAttribute(String name);
/**
* @since 1.7.10d
* @return Returns whether this item is a book
*/
public boolean isWrittenBook();
boolean isWrittenBook();
/**
* @since 1.7.10d
* @return Returns the books title
*/
public String getBookTitle();
String getBookTitle();
/**
* @since 1.7.10d
* @return Returns the books author
*/
public String getBookAuthor();
String getBookAuthor();
/**
* @since 1.7.10d
* @return If the item is a book, returns a string array with book pages
*/
public String[] getBookText();
String[] getBookText();
/**
* @return Returns whether or not this item is a block
*/
public boolean isBlock();
boolean isBlock();
public INbt getNbt();
INbt getNbt();
public INbt getItemNbt();
INbt getItemNbt();
/**
* No support is given for this method. Dont use if you dont know what you are doing.
* @return Minecraft ItemStack
*/
public ItemStack getMCItemStack();
ItemStack getMCItemStack();
NBTTagCompound getMCNbt();
void setMCNbt(NBTTagCompound compound);
}
@@ -19,4 +19,8 @@ public interface ILabel extends ICustomGuiComponent {
float getScale();
ILabel setScale(float var1);
boolean getShadow();
void setShadow(boolean shadow);
}
@@ -14,4 +14,8 @@ public interface IOverlayLabel extends ICustomOverlayComponent {
float getScale();
IOverlayLabel setScale(float var1);
boolean getShadow();
void setShadow(boolean shadow);
}
@@ -6,6 +6,98 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.entity.passive.EntityTameable;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.util.ValueUtil;
public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
boolean getIsShiny();
void setIsShiny(boolean bo);
int getLevel();
void setLevel(int level);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getIV(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setIV(int type, int value);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getEV(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setEV(int type, int value);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getStat(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setStat(int type, int value);
/**
* @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
*/
int getSize();
/**
* @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
*/
void setSize(int type);
/**
* @return 0-255
*/
int getHapiness();
/**
* @param value 0-255
*/
void setHapiness(int value);
/**
* @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
*/
int getNature();
/**
* @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
*/
void setNature(int type);
/**
* @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
*/
int getPokeball();
/**
* @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
*/
void setPokeball(int type);
String getNickname();
boolean hasNickname();
void setNickname(String name);
String getMove(int slot);
void setMove(int slot, String move);
}
@@ -1,103 +1,131 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.Server;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.containers.ContainerCustomGui;
import noppes.npcs.controllers.*;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptBlock;
import noppes.npcs.scripted.entity.ScriptDBCPlayer;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.handler.data.IQuest;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
import noppes.npcs.scripted.overlay.ScriptOverlay;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
/**
* @return Returns the displayed name of the player
*/
public String getDisplayName();
String getDisplayName();
/**
* @return Returns the players name
*/
public String getName();
String getName();
public void setPosition(double x, double y, double z);
void setPosition(double x, double y, double z);
public void setPosition(double x, double y, double z, int dimensionId);
void setPosition(double x, double y, double z, int dimensionId);
public boolean hasFinishedQuest(int id);
int getHunger();
public boolean hasActiveQuest(int id);
void setHunger(int hunger);
public void showDialog(int id);
float getSaturation();
public boolean hasReadDialog(int id);
void setSaturation(float saturation);
int getDimension();
boolean hasFinishedQuest(int id);
boolean hasActiveQuest(int id);
void showDialog(int id);
boolean hasReadDialog(int id);
/**
* Add the quest from active quest list
* @param id The Quest ID
*/
public void startQuest(int id);
void startQuest(int id);
/**
* Add the quest from finished quest list
* @param id The Quest ID
*/
public void finishQuest(int id);
void finishQuest(int id);
/**
* Removes the quest from active quest list
* @param id The Quest ID
*/
public void stopQuest(int id);
void stopQuest(int id);
/**
* Removes the quest from active and finished quest list
* @param id The Quest ID
*/
public void removeQuest(int id);
void removeQuest(int id);
public int getType();
int getType();
public boolean typeOf(int type);
boolean typeOf(int type);
/**
* @param faction The faction id
* @param points The points to increase. Use negative values to decrease
*/
public void addFactionPoints(int faction, int points);
void addFactionPoints(int faction, int points);
/**
* @param faction The faction id
* @return points
*/
public int getFactionPoints(int faction);
int getFactionPoints(int faction);
/**
* @param message The message you want to send
*/
public void sendMessage(String message);
void sendMessage(String message);
/**
* @return Return gamemode. 0: Survival, 1: Creative, 2: Adventure
*/
public int getMode();
int getMode();
/**
* @param type The gamemode type. 0:SURVIVAL, 1:CREATIVE, 2:ADVENTURE
*/
public void setMode(int type);
void setMode(int type);
/**
* @param item The item to be checked
* @return How many of this item the player has
*/
public int inventoryItemCount(ScriptItemStack item);
int inventoryItemCount(ScriptItemStack item);
/**
* @since 1.7.10d
* @return Returns a IItemStack array size 36
*/
public IItemStack[] getInventory();
IItemStack[] getInventory();
/**
* @param item The Item type to be removed
* @param amount How many will be removed
* @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given
*/
public boolean removeItem(ScriptItemStack item, int amount);
boolean removeItem(ScriptItemStack item, int amount);
/**
* @since 1.7.10c
@@ -106,7 +134,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param amount How many will be removed
* @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given or item doesnt exist
*/
public boolean removeItem(String id, int damage, int amount);
boolean removeItem(String id, int damage, int amount);
/**
* @since 1.7.10c
@@ -114,7 +142,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param amount The amount of the item to be added
* @return Returns whether or not it gave the item succesfully
*/
public boolean giveItem(ScriptItemStack item, int amount);
boolean giveItem(ScriptItemStack item, int amount);
/**
* @since 1.7.10c
@@ -123,7 +151,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param amount The amount of the item to be added
* @return Returns whether or not it gave the item succesfully
*/
public boolean giveItem(String id, int damage, int amount);
boolean giveItem(String id, int damage, int amount);
/**
* Same as the /spawnpoint command
@@ -131,49 +159,82 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param y The y position
* @param z The z position
*/
public void setSpawnpoint(int x, int y, int z);
void setSpawnpoint(int x, int y, int z);
public void resetSpawnpoint();
void resetSpawnpoint();
/**
* @param item The item to be removed from the players inventory
*/
public void removeAllItems(ScriptItemStack item);
void removeAllItems(ScriptItemStack item);
void setRotation(float rotationYaw, float rotationPitch);
void stopUsingItem();
void clearItemInUse();
void playSound(String name, float volume, float pitch);
void mountEntity(Entity ridingEntity);
ScriptEntity dropOneItem(boolean dropStack);
boolean canHarvestBlock(ScriptBlock block);
boolean interactWith(ScriptEntity entity);
/**
* @param achievement The achievement id. For a complete list see http://minecraft.gamepedia.com/Achievements
* @return Returns whether or not the player has this achievement
*/
public boolean hasAchievement(String achievement);
boolean hasAchievement(String achievement);
/**
* @param permission Bukkit/Cauldron permission
* @return Returns whether or not the player has the permission
*/
public boolean hasBukkitPermission(String permission);
boolean hasBukkitPermission(String permission);
/**
* @since 1.7.10c
* @return Returns the exp level
*/
public int getExpLevel();
int getExpLevel();
/**
* @since 1.7.10c
* @param level The new exp level you want to set
*/
public void setExpLevel(int level);
void setExpLevel(int level);
/**
* Requires pixelmon to be installed
* @since 1.7.10d
*/
public ScriptPixelmonPlayerData getPixelmonData();
ScriptPixelmonPlayerData getPixelmonData();
public ITimers getTimers();
ITimers getTimers();
public void updatePlayerInventory();
void updatePlayerInventory();
public boolean checkGUIOpen();
ScriptDBCPlayer<T> getDBCPlayer();
boolean blocking();
IQuest[] getActiveQuests();
IContainer getOpenContainer();
void showCustomGui(ICustomGui gui);
ICustomGui getCustomGui();
void closeGui();
void showCustomOverlay(ICustomOverlay overlay);
void closeOverlay(int id);
IQuest[] getFinishedQuests();
}
@@ -11,12 +11,12 @@ public interface IWorld {
/**
* @return The worlds time
*/
public long getTime();
long getTime();
/**
* @return The total world time
*/
public long getTotalTime();
long getTotalTime();
boolean areAllPlayersAsleep();
@@ -26,65 +26,65 @@ public interface IWorld {
* @param z World position z
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock(int x, int y, int z);
IBlock getBlock(int x, int y, int z);
IBlock getTopBlock(int x, int z);
public boolean isBlockFreezable(int x, int y, int z);
boolean isBlockFreezable(int x, int y, int z);
public boolean isBlockFreezableNaturally(int x, int y, int z);
boolean isBlockFreezableNaturally(int x, int y, int z);
public boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater);
boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater);
public boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater);
boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater);
public boolean canSnowAt(int x, int y, int z, boolean checkLight);
boolean canSnowAt(int x, int y, int z, boolean checkLight);
public boolean canSnowAtBody(int x, int y, int z, boolean checkLight);
boolean canSnowAtBody(int x, int y, int z, boolean checkLight);
public int getHeightValue(int x, int z);
int getHeightValue(int x, int z);
public int getChunkHeightMapMinimum(int x, int z);
int getChunkHeightMapMinimum(int x, int z);
public int getBlockMetadata(int x, int y, int z);
int getBlockMetadata(int x, int y, int z);
public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag);
boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag);
public boolean canBlockSeeTheSky(int x, int y, int z);
boolean canBlockSeeTheSky(int x, int y, int z);
public int getFullBlockLightValue(int x, int y, int z);
int getFullBlockLightValue(int x, int y, int z);
public int getBlockLightValue(int x, int y, int z);
int getBlockLightValue(int x, int y, int z);
public void playSoundAtEntity(ScriptEntity entity, String sound, float volume, float pitch);
void playSoundAtEntity(ScriptEntity entity, String sound, float volume, float pitch);
public void playSoundToNearExcept(ScriptPlayer player, String sound, float volume, float pitch);
void playSoundToNearExcept(ScriptPlayer player, String sound, float volume, float pitch);
public IEntity getEntityByID(int id);
IEntity getEntityByID(int id);
public boolean spawnEntityInWorld(ScriptEntity entity);
boolean spawnEntityInWorld(ScriptEntity entity);
public ScriptPlayer getClosestPlayerToEntity(ScriptEntity entity, double range);
ScriptPlayer getClosestPlayerToEntity(ScriptEntity entity, double range);
public ScriptPlayer getClosestPlayer(double x, double y, double z, double range);
ScriptPlayer getClosestPlayer(double x, double y, double z, double range);
public ScriptPlayer getClosestVulnerablePlayerToEntity(ScriptEntity entity, double range);
ScriptPlayer getClosestVulnerablePlayerToEntity(ScriptEntity entity, double range);
public ScriptPlayer getClosestVulnerablePlayer(double x, double y, double z, double range);
ScriptPlayer getClosestVulnerablePlayer(double x, double y, double z, double range);
public int countEntities(ScriptEntity entity);
int countEntities(ScriptEntity entity);
public void setTileEntity(int x, int y, int z, ScriptTileEntity tileEntity);
void setTileEntity(int x, int y, int z, ScriptTileEntity tileEntity);
public void removeTileEntity(int x, int y, int z);
void removeTileEntity(int x, int y, int z);
public boolean isBlockFullCube(int x, int y, int z);
boolean isBlockFullCube(int x, int y, int z);
public long getSeed();
long getSeed();
public void setSpawnLocation(int x, int y, int z);
void setSpawnLocation(int x, int y, int z);
public boolean canLightningStrikeAt(int x, int y, int z);
boolean canLightningStrikeAt(int x, int y, int z);
boolean isBlockHighHumidity(int x, int y, int z);
@@ -95,7 +95,7 @@ public interface IWorld {
* @return Text from signs
* @since 1.7.10d
*/
public String getSignText(int x, int y, int z);
String getSignText(int x, int y, int z);
/**
* @param x World position x
@@ -103,49 +103,49 @@ public interface IWorld {
* @param z World position z
* @param item The block to be set
*/
public void setBlock(int x, int y, int z, ScriptItemStack item);
void setBlock(int x, int y, int z, ScriptItemStack item);
/**
* @param x World position x
* @param y World position y
* @param z World position z
*/
public void removeBlock(int x, int y, int z);
void removeBlock(int x, int y, int z);
/**
* @param name The name of the player to be returned
* @return The Player with name. Null is returned when the player isnt found
*/
public ScriptPlayer getPlayer(String name);
ScriptPlayer getPlayer(String name);
ScriptPlayer getPlayerByUUID(String uuid);
/**
* @param time The world time to be set
*/
public void setTime(long time);
void setTime(long time);
/**
* @return Whether or not its daytime
*/
public boolean isDay();
boolean isDay();
/**
* @return Whether or not its currently raining
*/
public boolean isRaining();
boolean isRaining();
/**
* @param bo Set if it's raining
*/
public void setRaining(boolean bo);
void setRaining(boolean bo);
/**
* @param x The x position
* @param y The y position
* @param z The z position
*/
public void thunderStrike(double x, double y, double z);
void thunderStrike(double x, double y, double z);
/**
* Sends a packet from the server to the client everytime its called. Probably should not use this too much.
@@ -159,7 +159,7 @@ public interface IWorld {
* @param speed Speed of the particles, usually between 0 and 1
* @param count Particle count
*/
public void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count);
void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count);
/**
* @param id The items name
@@ -167,71 +167,71 @@ public interface IWorld {
* @param size The number of items in the item
* @return Returns the item
*/
public IItemStack createItem(String id, int damage, int size);
IItemStack createItem(String id, int damage, int size);
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
* @return Returns ScriptEntityParticle object
*/
public ScriptParticle createEntityParticle(String directory);
ScriptParticle createEntityParticle(String directory);
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
public Object getTempData(String key);
Object getTempData(String key);
/**
* Tempdata gets cleared when the server restarts. All worlds share the same temp data.
* @param key The key for the data stored
* @param value The data stored
*/
public void setTempData(String key, Object value);
void setTempData(String key, Object value);
/**
* @param key The key thats going to be tested against the temp data
* @return Whether or not temp data containes the key
*/
public boolean hasTempData(String key);
boolean hasTempData(String key);
/**
* @param key The key for the temp data to be removed
*/
public void removeTempData(String key);
void removeTempData(String key);
/**
* Removes all tempdata
*/
public void clearTempData();
void clearTempData();
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
public Object getStoredData(String key);
Object getStoredData(String key);
/**
* Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved
* @param key The key for the data stored
* @param value The data stored. This data can be either a Number or a String. Other data is not stored
*/
public void setStoredData(String key, Object value);
void setStoredData(String key, Object value);
/**
* @param key The key of the data to be checked
* @return Returns whether or not the stored data contains the key
*/
public boolean hasStoredData(String key);
boolean hasStoredData(String key);
/**
* @param key The key of the data to be removed
*/
public void removeStoredData(String key);
void removeStoredData(String key);
/**
* Remove all stored data
*/
public void clearStoredData();
void clearStoredData();
/**
* @param x Position x
@@ -241,9 +241,9 @@ public interface IWorld {
* @param fire Whether or not the explosion does fire damage
* @param grief Whether or not the explosion does damage to blocks
*/
public void explode(double x, double y, double z, float range, boolean fire, boolean grief);
void explode(double x, double y, double z, float range, boolean fire, boolean grief);
public ScriptPlayer[] getAllServerPlayers();
ScriptPlayer[] getAllServerPlayers();
/**
* @since 1.7.10c
@@ -251,7 +251,7 @@ public interface IWorld {
* @param z Position z
* @return Returns the name of the biome
*/
public String getBiomeName(int x, int z);
String getBiomeName(int x, int z);
/**
* Lets you spawn a server side cloned entity
@@ -262,9 +262,9 @@ public interface IWorld {
* @param name Name of the cloned entity
* @return Returns the entity which was spawned
*/
public ScriptEntity spawnClone(int x, int y, int z, int tab, String name);
ScriptEntity spawnClone(int x, int y, int z, int tab, String name);
public ScriptScoreboard getScoreboard();
ScriptScoreboard getScoreboard();
BlockPos getMCBlockPos(int x, int y, int z);
@@ -273,7 +273,7 @@ public interface IWorld {
* Expert use only
* @return Returns minecraft world object
*/
public WorldServer getMCWorld();
WorldServer getMCWorld();
public int getDimensionID();
int getDimensionID();
}
@@ -37,10 +37,6 @@ public class ScriptOverlay implements ICustomOverlay {
return this.components;
}
public PlayerDataScript getScriptHandler() {
return ScriptController.Instance.playerScripts;//this.scriptHandler;
}
public int getDefaultAlignment(){
return this.defaultAlignment;
}