mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 22:19:40 +00:00
Merge branch 'master' into dev
# Conflicts: # src/main/java/noppes/npcs/scripted/ScriptFaction.java # src/main/java/noppes/npcs/scripted/ScriptWorld.java # src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java # src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java # src/main/java/noppes/npcs/scripted/interfaces/IEntity.java # src/main/java/noppes/npcs/scripted/interfaces/IWorld.java # src/main/java/noppes/npcs/scripted/interfaces/entity/ICustomNpc.java # src/main/java/noppes/npcs/scripted/interfaces/entity/IPlayer.java
This commit is contained in:
commit
ec5fc71413
300 files changed
+9920
-2959
No files matched your search
@@ -2,7 +2,7 @@ package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IAnimal;
|
||||
import noppes.npcs.scripted.interfaces.entity.IAnimal;
|
||||
|
||||
public class ScriptAnimal<T extends EntityAnimal> extends ScriptLiving<T> implements IAnimal {
|
||||
|
||||
|
||||
@@ -5,11 +5,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
|
||||
public T player;
|
||||
@@ -430,15 +427,15 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
|
||||
return compound.getCompoundTag("JRMCEP").getString("extracode");
|
||||
}
|
||||
|
||||
public ScriptItemStack[] getInventory(){
|
||||
public IItemStack[] getInventory(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.player.writeToNBT(compound);
|
||||
|
||||
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
|
||||
ScriptItemStack[] itemList = new ScriptItemStack[list.tagCount()];
|
||||
IItemStack[] itemList = new IItemStack[list.tagCount()];
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
ItemStack itemStack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
itemList[i] = new ScriptItemStack(itemStack);
|
||||
itemList[i] = NpcAPI.Instance().getIItemStack(itemStack);
|
||||
}
|
||||
|
||||
return itemList;
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
@@ -31,9 +30,11 @@ import noppes.npcs.scripted.ScriptEntityParticle;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.INbt;
|
||||
import noppes.npcs.scripted.interfaces.IPos;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
protected T entity;
|
||||
@@ -68,6 +69,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
* @param scaleRate Multiplier for the particle's transparency growth rate
|
||||
* @param alphaRateStart The time at which the particle begins appearing/fading
|
||||
*/
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
@@ -79,7 +81,9 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
@@ -87,9 +91,13 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
@@ -97,7 +105,9 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
@@ -105,16 +115,22 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
@@ -122,15 +138,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
0, 0, 0, 0,
|
||||
@@ -138,14 +160,20 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
x, y, z,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
@@ -153,13 +181,19 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory,
|
||||
HEXcolor, HEXcolor, 0, 0,
|
||||
amount, maxAge,
|
||||
0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
@@ -167,10 +201,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
true, -1, -1, 0,0,
|
||||
0, true, 0, 0,
|
||||
entityID, entity.dimension
|
||||
);
|
||||
}
|
||||
public void spawnParticle(ScriptEntityParticle entityParticle) { entityParticle.spawnOnEntity(this); }
|
||||
|
||||
public void spawnParticle(ScriptParticle entityParticle) { entityParticle.spawnOnEntity(this); }
|
||||
|
||||
public int getEntityId(){
|
||||
return entity.getEntityId();
|
||||
}
|
||||
|
||||
public String getUniqueID(){
|
||||
return entity.getUniqueID().toString();
|
||||
}
|
||||
|
||||
public double getYOffset() { return entity.getYOffset(); }
|
||||
|
||||
@@ -319,18 +364,22 @@ 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
|
||||
*/
|
||||
public ScriptEntity[] getSurroundingEntities(int range){
|
||||
public IEntity[] getSurroundingEntities(int range){
|
||||
List<Entity> entities = entity.worldObj.getEntitiesWithinAABB(Entity.class, entity.boundingBox.expand(range, range, range));
|
||||
List<ScriptEntity> list = new ArrayList<ScriptEntity>();
|
||||
List<IEntity> list = new ArrayList<IEntity>();
|
||||
for(Entity living : entities){
|
||||
if(living != entity)
|
||||
list.add(ScriptController.Instance.getScriptForEntity(living));
|
||||
list.add(NpcAPI.Instance().getIEntity(living));
|
||||
}
|
||||
return list.toArray(new ScriptEntity[list.size()]);
|
||||
return list.toArray(new IEntity[list.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,7 +387,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
* @param type The EntityType you want to find
|
||||
* @return Array of entities within range
|
||||
*/
|
||||
public ScriptEntity[] getSurroundingEntities(int range, int type){
|
||||
public IEntity[] getSurroundingEntities(int range, int type){
|
||||
Class cls = Entity.class;
|
||||
if(type == EntityType.LIVING)
|
||||
cls = EntityLivingBase.class;
|
||||
@@ -352,12 +401,12 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
cls = EntityNPCInterface.class;
|
||||
|
||||
List<Entity> entities = entity.worldObj.getEntitiesWithinAABB(cls, entity.boundingBox.expand(range, range, range));
|
||||
List<ScriptEntity> list = new ArrayList<ScriptEntity>();
|
||||
List<IEntity> list = new ArrayList<IEntity>();
|
||||
for(Entity living : entities){
|
||||
if(living != entity)
|
||||
list.add(ScriptController.Instance.getScriptForEntity(living));
|
||||
list.add(NpcAPI.Instance().getIEntity(living));
|
||||
}
|
||||
return list.toArray(new ScriptEntity[list.size()]);
|
||||
return list.toArray(new IEntity[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -549,23 +598,23 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
/**
|
||||
* @param item Item to be dropped
|
||||
*/
|
||||
public void dropItem(ScriptItemStack item){
|
||||
entity.entityDropItem(item.item, 0);
|
||||
public void dropItem(IItemStack item){
|
||||
entity.entityDropItem(item.getMCItemStack(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Return the rider
|
||||
*/
|
||||
public ScriptEntity getRider(){
|
||||
return ScriptController.Instance.getScriptForEntity(entity.riddenByEntity);
|
||||
public IEntity getRider(){
|
||||
return NpcAPI.Instance().getIEntity(entity.riddenByEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity The entity to ride this entity
|
||||
*/
|
||||
public void setRider(ScriptEntity entity){
|
||||
public void setRider(IEntity entity){
|
||||
if(entity != null){
|
||||
entity.entity.mountEntity(this.entity);;
|
||||
entity.getMCEntity().mountEntity(this.entity);;
|
||||
}
|
||||
else if(this.entity.riddenByEntity != null)
|
||||
this.entity.riddenByEntity.mountEntity(null);
|
||||
@@ -574,18 +623,18 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
/**
|
||||
* @return Return the entity, this entity is riding
|
||||
*/
|
||||
public ScriptEntity getMount(){
|
||||
return ScriptController.Instance.getScriptForEntity(entity.ridingEntity);
|
||||
public IEntity getMount(){
|
||||
return NpcAPI.Instance().getIEntity(entity.ridingEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity The entity this entity will mount
|
||||
*/
|
||||
public void setMount(ScriptEntity entity){
|
||||
public void setMount(IEntity entity){
|
||||
if(entity == null)
|
||||
this.entity.mountEntity(null);
|
||||
else
|
||||
this.entity.mountEntity(entity.entity);
|
||||
this.entity.mountEntity(entity.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,6 +693,18 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
entity.hurtResistantTime = ticks;
|
||||
};
|
||||
|
||||
public void setInvisible(boolean invisible){
|
||||
entity.setInvisible(invisible);
|
||||
}
|
||||
|
||||
public void setSneaking(boolean sneaking){
|
||||
entity.setSneaking(sneaking);
|
||||
}
|
||||
|
||||
public void setSprinting(boolean sprinting){
|
||||
entity.setSprinting(sprinting);
|
||||
}
|
||||
|
||||
public boolean hasCollided() {
|
||||
return entity.isCollided;
|
||||
}
|
||||
@@ -697,6 +758,6 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
}
|
||||
|
||||
public ScriptWorld getWorld() {
|
||||
return (ScriptWorld)NpcAPI.Instance().getIWorld((WorldServer) entity.worldObj);
|
||||
return (ScriptWorld) NpcAPI.Instance().getIWorld((WorldServer) entity.worldObj);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.interfaces.IEntityLiving;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLiving;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
|
||||
public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> implements IEntityLiving {
|
||||
|
||||
@@ -18,17 +20,17 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackTarget(ScriptLivingBase living){
|
||||
public void setAttackTarget(IEntityLivingBase living){
|
||||
if(living == null)
|
||||
entity.setAttackTarget(null);
|
||||
else
|
||||
entity.setAttackTarget(living.entity);
|
||||
entity.setAttackTarget(living.getMCEntity());
|
||||
super.setAttackTarget(living);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptLivingBase getAttackTarget(){
|
||||
ScriptLivingBase base = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAttackTarget());
|
||||
public IEntityLivingBase getAttackTarget(){
|
||||
IEntityLivingBase base = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAttackTarget());
|
||||
return (base != null)? base: super.getAttackTarget();
|
||||
}
|
||||
|
||||
@@ -58,7 +60,7 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeeEntity(ScriptEntity entity){
|
||||
return this.entity.getEntitySenses().canSee(entity.entity);
|
||||
public boolean canSeeEntity(IEntity entity){
|
||||
return this.entity.getEntitySenses().canSee(entity.getMCEntity());
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,16 @@ package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.wrapper.ScriptDamageSource;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptDamageSource;
|
||||
|
||||
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase {
|
||||
protected T entity;
|
||||
@@ -40,7 +39,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
entity.attackEntityFrom(DamageSource.generic,damage);
|
||||
}
|
||||
|
||||
public void hurt(float damage, ScriptEntity source) {
|
||||
public void hurt(float damage, IEntity source) {
|
||||
if(source.getType() == 1)//if player
|
||||
entity.attackEntityFrom(new EntityDamageSource("player",source.getMCEntity()),damage);
|
||||
else
|
||||
@@ -67,18 +66,18 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
/**
|
||||
* @param living Entity which this entity will attack
|
||||
*/
|
||||
public void setAttackTarget(ScriptLivingBase living){
|
||||
public void setAttackTarget(IEntityLivingBase living){
|
||||
if(living == null)
|
||||
entity.setRevengeTarget(null);
|
||||
else
|
||||
entity.setRevengeTarget(living.entity);
|
||||
entity.setRevengeTarget(living.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The entity which this entity is attacking
|
||||
*/
|
||||
public ScriptLivingBase getAttackTarget(){
|
||||
return (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAITarget());
|
||||
public IEntityLivingBase getAttackTarget(){
|
||||
return (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity.getAITarget());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,14 +88,14 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
|
||||
@Override
|
||||
public boolean typeOf(int type){
|
||||
return type == EntityType.LIVING?true:super.typeOf(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(ScriptEntity entity){
|
||||
return this.entity.canEntityBeSeen(entity.entity);
|
||||
public boolean canSeeEntity(IEntity entity){
|
||||
return this.entity.canEntityBeSeen(entity.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,6 +116,10 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
public void swingHand(){
|
||||
entity.swingItem();
|
||||
}
|
||||
|
||||
public String getLookVec(){
|
||||
return entity.getLookVec().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Works the same as the <a href="http://minecraft.gamepedia.com/Commands#effect">/effect command</a>
|
||||
@@ -169,11 +172,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
* @since 1.7.10c
|
||||
* @return The item the entity is holding
|
||||
*/
|
||||
public ScriptItemStack getHeldItem(){
|
||||
ItemStack item = entity.getHeldItem();
|
||||
if(item == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getHeldItem(){
|
||||
return NpcAPI.Instance().getIItemStack(entity.getHeldItem());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,8 +181,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
* @since 1.7.10c
|
||||
* @param item The item to be set
|
||||
*/
|
||||
public void setHeldItem(ScriptItemStack item){
|
||||
entity.setCurrentItemOrArmor(0, item == null?null:item.item);
|
||||
public void setHeldItem(IItemStack item){
|
||||
entity.setCurrentItemOrArmor(0, item == null?null:item.getMCItemStack());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,11 +190,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
* @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 ScriptItemStack getArmor(int slot){
|
||||
ItemStack item = entity.getEquipmentInSlot(slot + 1);
|
||||
if(item == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getArmor(int slot){
|
||||
return NpcAPI.Instance().getIItemStack(entity.getEquipmentInSlot(slot + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,7 +200,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<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){
|
||||
entity.setCurrentItemOrArmor(slot + 1, item == null?null:item.item);
|
||||
public void setArmor(int slot, IItemStack item){
|
||||
entity.setCurrentItemOrArmor(slot + 1, item == null?null:item.getMCItemStack());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IMonster;
|
||||
import noppes.npcs.scripted.interfaces.entity.IMonster;
|
||||
|
||||
public class ScriptMonster<T extends EntityMob> extends ScriptLiving<T> implements IMonster {
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptFaction;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.constants.AnimationType;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.interfaces.ITimers;
|
||||
import noppes.npcs.scripted.roles.ScriptJobBard;
|
||||
import noppes.npcs.scripted.roles.ScriptJobConversation;
|
||||
@@ -28,6 +31,7 @@ import noppes.npcs.scripted.roles.ScriptRoleInterface;
|
||||
import noppes.npcs.scripted.roles.ScriptRoleMailman;
|
||||
import noppes.npcs.scripted.roles.ScriptRoleTrader;
|
||||
import noppes.npcs.scripted.roles.ScriptRoleTransporter;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -259,26 +263,26 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @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){
|
||||
public void shootItem(IEntityLivingBase target, IItemStack item, int accuracy){
|
||||
if(item == null)
|
||||
return;
|
||||
if(accuracy < 0)
|
||||
accuracy = 0;
|
||||
else if(accuracy > 100)
|
||||
accuracy = 100;
|
||||
npc.shoot(target.entity, accuracy, item.item, false);
|
||||
npc.shoot(target.getMCEntity(), accuracy, item.getMCItemStack(), false);
|
||||
}
|
||||
|
||||
public void setProjectilesKeepTerrain(boolean t) {
|
||||
npc.stats.projectilesKeepTerrain = t;
|
||||
}
|
||||
|
||||
|
||||
public boolean getProjectilesKeepTerrain() {
|
||||
return npc.stats.projectilesKeepTerrain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param message The message the npc will say
|
||||
*/
|
||||
@@ -289,10 +293,10 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @param message The message the npc will say
|
||||
*/
|
||||
public void say(ScriptPlayer player, String message){
|
||||
public void say(IPlayer player, String message){
|
||||
if(player == null || message == null || message.isEmpty())
|
||||
return;
|
||||
npc.say(player.player, new Line(message));
|
||||
npc.say((EntityPlayer) player.getMCEntity(), new Line(message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,6 +329,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) {
|
||||
@@ -356,6 +361,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) {
|
||||
@@ -368,63 +374,54 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @return The item held in the right hand
|
||||
*/
|
||||
public ScriptItemStack getRightItem(){
|
||||
ItemStack item = npc.inventory.getWeapon();
|
||||
if(item == null || item.getItem() == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getRightItem(){
|
||||
return NpcAPI.Instance().getIItemStack(npc.inventory.getWeapon());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item Item to be held in the right hand
|
||||
*/
|
||||
public void setRightItem(ScriptItemStack item){
|
||||
public void setRightItem(IItemStack item){
|
||||
if(item == null)
|
||||
npc.inventory.setWeapon(null);
|
||||
else
|
||||
npc.inventory.setWeapon(item.item);
|
||||
npc.inventory.setWeapon(item.getMCItemStack());
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The item held in the left hand
|
||||
*/
|
||||
public ScriptItemStack getLefttItem(){
|
||||
ItemStack item = npc.getOffHand();
|
||||
if(item == null || item.getItem() == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getLefttItem(){
|
||||
return NpcAPI.Instance().getIItemStack(npc.getOffHand());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item Item to be held in the left hand
|
||||
*/
|
||||
public void setLeftItem(ScriptItemStack item){
|
||||
public void setLeftItem(IItemStack item){
|
||||
if(item == null)
|
||||
npc.inventory.setOffHand(null);
|
||||
else
|
||||
npc.inventory.setOffHand(item.item);
|
||||
npc.inventory.setOffHand(item.getMCItemStack());
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the projectile the npc uses
|
||||
*/
|
||||
public ScriptItemStack getProjectileItem(){
|
||||
ItemStack item = npc.inventory.getProjectile();
|
||||
if(item == null || item.getItem() == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getProjectileItem(){
|
||||
return NpcAPI.Instance().getIItemStack(npc.inventory.getProjectile());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item Item to be used as projectile
|
||||
*/
|
||||
public void setProjectileItem(ScriptItemStack item){
|
||||
public void setProjectileItem(IItemStack item){
|
||||
if(item == null)
|
||||
npc.inventory.setProjectile(null);
|
||||
else
|
||||
npc.inventory.setProjectile(item.item);
|
||||
npc.inventory.setProjectile(item.getMCItemStack());
|
||||
npc.script.aiNeedsUpdate = true;
|
||||
}
|
||||
|
||||
@@ -498,11 +495,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @return Returns the worn armor in slot
|
||||
*/
|
||||
@Override
|
||||
public ScriptItemStack getArmor(int slot){
|
||||
ItemStack item = npc.inventory.armor.get(slot);
|
||||
if(item == null)
|
||||
return null;
|
||||
return new ScriptItemStack(item);
|
||||
public IItemStack getArmor(int slot){
|
||||
return NpcAPI.Instance().getIItemStack(npc.inventory.armor.get(slot));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,11 +504,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param item Item to be set as armor
|
||||
*/
|
||||
@Override
|
||||
public void setArmor(int slot, ScriptItemStack item){
|
||||
public void setArmor(int slot, IItemStack item){
|
||||
if(item == null)
|
||||
npc.inventory.armor.put(slot, null);
|
||||
else
|
||||
npc.inventory.armor.put(slot, item.item);
|
||||
npc.inventory.armor.put(slot, item.getMCItemStack());
|
||||
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
}
|
||||
@@ -524,8 +518,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param slot The slot from the NPC's drop list to return (0-8)
|
||||
* @return
|
||||
*/
|
||||
public ScriptItemStack getLootItem(int slot) {
|
||||
return new ScriptItemStack(npc.inventory.getStackInSlot(slot+7));
|
||||
public IItemStack getLootItem(int slot) {
|
||||
return NpcAPI.Instance().getIItemStack(npc.inventory.getStackInSlot(slot+7));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,9 +527,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @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) {
|
||||
if (item == null) npc.inventory.setInventorySlotContents(slot+7, null);
|
||||
else npc.inventory.setInventorySlotContents(slot+7, item.item);
|
||||
public void setLootItem(int slot, IItemStack item) {
|
||||
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -714,8 +707,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
return npc.display.visible;
|
||||
}
|
||||
|
||||
public void setVisibleTo(ScriptPlayer player, boolean visible) {
|
||||
UUID uuid = player.player.getPersistentID();
|
||||
public void setVisibleTo(IPlayer player, boolean visible) {
|
||||
UUID uuid = player.getMCEntity().getPersistentID();
|
||||
ArrayList<UUID> uuidList = npc.display.invisibleToList;
|
||||
if(uuidList != null) {
|
||||
if (!uuidList.contains(uuid)) {
|
||||
@@ -728,8 +721,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
}
|
||||
|
||||
public boolean isVisibleTo(ScriptPlayer player) {
|
||||
return !npc.scriptInvisibleToPlayer(player.player);
|
||||
public boolean isVisibleTo(IPlayer player) {
|
||||
return !npc.scriptInvisibleToPlayer((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -870,8 +863,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
npc.stats.playerSetCanDespawn = canDespawn;
|
||||
}
|
||||
|
||||
public void giveItem(ScriptPlayer player, ScriptItemStack item){
|
||||
npc.givePlayerItem(player.player, item.item);
|
||||
public void giveItem(IPlayer player, IItemStack item){
|
||||
npc.givePlayerItem((EntityPlayer) player.getMCEntity(), item.getMCItemStack());
|
||||
}
|
||||
|
||||
public void executeCommand(String command){
|
||||
@@ -1018,7 +1011,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void setCanDrown(boolean d) {
|
||||
npc.stats.canDrown = d;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getAge(){
|
||||
return npc.totalTicksAlive;
|
||||
@@ -1121,12 +1114,19 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public void setOverlayTexture(String overlayTexture) {
|
||||
npc.display.glowTexture = overlayTexture;
|
||||
this.getOverlays().add(0, NpcAPI.Instance().createSkinOverlay(overlayTexture));
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public String getOverlayTexture() {
|
||||
return npc.display.glowTexture;
|
||||
if (!npc.display.skinOverlayData.overlayList.containsKey(0))
|
||||
return "";
|
||||
|
||||
return npc.display.skinOverlayData.overlayList.get(0).getTexture();
|
||||
}
|
||||
|
||||
public IOverlayHandler getOverlays() {
|
||||
return npc.display.skinOverlayData;
|
||||
}
|
||||
|
||||
public void setCollisionType(int type){
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.scripted.entity;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.scripted.interfaces.IPixelmon;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPixelmon;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptPixelmon<T extends EntityTameable> extends ScriptAnimal<T> implements IPixelmon {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -37,10 +38,13 @@ import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.Quest;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.gui.ScriptGui;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
@@ -50,9 +54,20 @@ import noppes.npcs.scripted.interfaces.ICustomGui;
|
||||
import noppes.npcs.scripted.interfaces.ICustomOverlay;
|
||||
import noppes.npcs.scripted.interfaces.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.ITimers;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
|
||||
import noppes.npcs.scripted.overlay.ScriptOverlay;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
|
||||
public T player;
|
||||
private PlayerData data;
|
||||
@@ -111,11 +126,6 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
player.getFoodStats().addStats(0,saturation-prevSaturation);
|
||||
}
|
||||
|
||||
public int getDimension(){
|
||||
return player.dimension;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasFinishedQuest(int id){
|
||||
PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
@@ -139,11 +149,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
PlayerDialogData data = PlayerDataController.instance.getPlayerData(player).dialogData;
|
||||
return data.dialogsRead.contains(id);
|
||||
}
|
||||
|
||||
|
||||
public void readDialog(int id) {
|
||||
PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.add(id);
|
||||
}
|
||||
|
||||
|
||||
public void unreadDialog(int id) {
|
||||
PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.remove(id);
|
||||
}
|
||||
@@ -159,7 +169,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
if(data.questData.activeQuests.containsKey(id))
|
||||
return;
|
||||
QuestData questdata = new QuestData(quest);
|
||||
QuestData questdata = new QuestData(quest);
|
||||
data.questData.activeQuests.put(id, questdata);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
@@ -227,7 +237,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
data.factionData.increasePoints(faction, points-getFactionPoints(faction), player);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param faction The faction id
|
||||
* @return points
|
||||
@@ -257,7 +267,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
chat.setChatStyle(style);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param message The message you want to send
|
||||
*/
|
||||
@@ -273,7 +283,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
chat.setChatStyle(style);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Return gamemode. 0: Survival, 1: Creative, 2: Adventure
|
||||
*/
|
||||
@@ -292,10 +302,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @param item The item to be checked
|
||||
* @return How many of this item the player has
|
||||
*/
|
||||
public int inventoryItemCount(ScriptItemStack item){
|
||||
public int inventoryItemCount(IItemStack item){
|
||||
int i = 0;
|
||||
for(ItemStack is : player.inventory.mainInventory){
|
||||
if (is != null && is.isItemEqual(item.item))
|
||||
if (is != null && is.isItemEqual(item.getMCItemStack()))
|
||||
i += is.stackSize;
|
||||
}
|
||||
return i;
|
||||
@@ -305,12 +315,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @since 1.7.10d
|
||||
* @return Returns a IItemStack array size 36
|
||||
*/
|
||||
public ScriptItemStack[] getInventory(){
|
||||
ScriptItemStack[] items = new ScriptItemStack[36];
|
||||
public IItemStack[] getInventory(){
|
||||
IItemStack[] items = new IItemStack[36];
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++){
|
||||
ItemStack item = player.inventory.mainInventory[i];
|
||||
if(item != null)
|
||||
items[i] = new ScriptItemStack(item);
|
||||
items[i] = NpcAPI.Instance().getIItemStack(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@@ -320,7 +330,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<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
|
||||
*/
|
||||
public boolean removeItem(ScriptItemStack item, int amount){
|
||||
public boolean removeItem(IItemStack item, int amount){
|
||||
int count = inventoryItemCount(item);
|
||||
if(amount > count)
|
||||
return false;
|
||||
@@ -329,7 +339,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
else{
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++){
|
||||
ItemStack is = player.inventory.mainInventory[i];
|
||||
if (is != null && is.isItemEqual(item.item)){
|
||||
if (is != null && is.isItemEqual(item.getMCItemStack())){
|
||||
if(amount > is.stackSize){
|
||||
player.inventory.mainInventory[i] = null;
|
||||
amount -= is.stackSize;
|
||||
@@ -356,7 +366,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
Item item = (Item)Item.itemRegistry.getObject(id);
|
||||
if(item == null)
|
||||
return false;
|
||||
return removeItem(new ScriptItemStack(new ItemStack(item, 1, damage)), amount);
|
||||
return removeItem(NpcAPI.Instance().getIItemStack(new ItemStack(item, 1, damage)), amount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,7 +375,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<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){
|
||||
public boolean giveItem(IItemStack item, int amount){
|
||||
if(item != null && item.getMCItemStack() != null) {
|
||||
item.setStackSize(amount);
|
||||
boolean bool = this.player.inventory.addItemStackToInventory(item.getMCItemStack());
|
||||
@@ -410,14 +420,14 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
/**
|
||||
* @param item The item to be removed from the players inventory
|
||||
*/
|
||||
public void removeAllItems(ScriptItemStack item){
|
||||
public void removeAllItems(IItemStack item){
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++){
|
||||
ItemStack is = player.inventory.mainInventory[i];
|
||||
if (is != null && is.isItemEqual(item.item))
|
||||
if (is != null && is.isItemEqual(item.getMCItemStack()))
|
||||
player.inventory.mainInventory[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void clearInventory() {
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++) player.inventory.mainInventory[i] = null;
|
||||
for(int i = 0; i < player.inventory.armorInventory.length; i++) player.inventory.armorInventory[i] = null;
|
||||
@@ -430,7 +440,39 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
public void setRotation(float rotationYaw, float rotationPitch){
|
||||
NoppesUtilPlayer.teleportPlayer(player, player.posX, player.posY, player.posZ, rotationYaw, rotationPitch, player.dimension);
|
||||
}
|
||||
|
||||
|
||||
public void swingHand(){
|
||||
NoppesUtilPlayer.swingPlayerArm(player);
|
||||
}
|
||||
|
||||
public void stopUsingItem(){
|
||||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
public void clearItemInUse(){
|
||||
player.clearItemInUse();
|
||||
}
|
||||
|
||||
public void playSound(String name, float volume, float pitch){
|
||||
player.playSound(name, volume, pitch);
|
||||
}
|
||||
|
||||
public void mountEntity(Entity ridingEntity){
|
||||
player.mountEntity(ridingEntity);
|
||||
}
|
||||
|
||||
public IEntity dropOneItem(boolean dropStack){
|
||||
return NpcAPI.Instance().getIEntity(player.dropOneItem(dropStack));
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(IBlock block){
|
||||
return player.canHarvestBlock(block.getMCBlock());
|
||||
}
|
||||
|
||||
public boolean interactWith(IEntity entity){
|
||||
return player.interactWith(entity.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
@@ -477,12 +519,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return null;
|
||||
return new ScriptPixelmonPlayerData(player);
|
||||
}
|
||||
|
||||
|
||||
public IBlock getLookingAtBlock(int maxDistance) {
|
||||
Vec3 lookVec = player.getLookVec();
|
||||
return getWorld().rayCastBlock(
|
||||
new double[] {player.posX, player.posY+player.getEyeHeight(), player.posZ},
|
||||
new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
|
||||
new double[] {player.posX, player.posY+player.getEyeHeight(), player.posZ},
|
||||
new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
|
||||
maxDistance);
|
||||
}
|
||||
|
||||
@@ -497,6 +539,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);
|
||||
@@ -566,7 +609,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void closeOverlay(int id) {
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.OVERLAY_CLOSE, id, new NBTTagCompound());
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.SCRIPT_OVERLAY_CLOSE, id, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public IOverlayHandler getOverlays() {
|
||||
return this.getData().skinOverlays;
|
||||
}
|
||||
|
||||
public IQuest[] getFinishedQuests() {
|
||||
|
||||
Reference in new issue
Block a user