Added several more functions to pre-existing classes:

-Spawner, Transport, Healer, Guard, Bard jobs received more functions.
-Added more functions to the transporter role.
-IRole: Added getNpc() function.
-IAnimal, IEntityLiving, and IEntityLivingBase received more functions from their MC counterparts.
-Nearly every function with that takes position/vector parameters now has an equivalent with IPos as a parameter instead.
This commit is contained in:
Luis C.M committed 2022-11-05 20:19:14 -05:00
1 parent 112e82a09d
commit e9a8f8cebc
51 files changed
+1025 -227

No files matched your search

@@ -363,6 +363,14 @@ public class ScriptEntity<T extends Entity> implements IEntity {
this.setMotionZ(z);
}
public void setMotion(IPos pos) {
this.setMotion(pos.getX(),pos.getY(),pos.getZ());
}
public IPos getMotion() {
return NpcAPI.Instance().getIPos(entity.motionX,entity.motionY,entity.motionZ);
}
public boolean isAirborne(){
return entity.isAirBorne;
}
@@ -398,13 +406,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
}
public IPos getPos() {
return new ScriptBlockPos(new BlockPos(entity.posX,entity.posY,entity.posZ));
return NpcAPI.Instance().getIPos(entity.posX, entity.posY, entity.posZ);
}
public IPos getPosition() {
return getPos();
}
public void setPos(IPos pos) {
this.entity.setPosition((double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F));
}
public void setPosition(IPos pos) {
this.setPos(pos);
}
public int getDimension(){
return entity.dimension;
}
@@ -730,6 +746,10 @@ public class ScriptEntity<T extends Entity> implements IEntity {
entity.velocityChanged = true;
}
public void knockback(IPos pos, float direction){
this.knockback(pos.getX(),pos.getY(),pos.getZ(),direction);
}
public void setImmune(int ticks) {
entity.hurtResistantTime = ticks;
};
@@ -789,6 +809,11 @@ public class ScriptEntity<T extends Entity> implements IEntity {
this.entity.readFromNBT(nbt.getMCNBT());
}
public INbt getNbtOptional() {
NBTTagCompound compound = new NBTTagCompound();
return this.entity.writeToNBTOptional(compound) ? NpcAPI.Instance().getINbt(compound) : null;
}
public void storeAsClone(int tab, String name) {
NBTTagCompound compound = new NBTTagCompound();
if (!this.entity.writeToNBTOptional(compound)) {