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

@@ -4,27 +4,39 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import noppes.npcs.scripted.interfaces.IBlock;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.ITileEntity;
import noppes.npcs.scripted.interfaces.*;
public class ScriptTileEntity<T extends TileEntity> implements ITileEntity {
protected T tileEntity;
protected IWorld world;
public ScriptTileEntity(T tileEntity) { this.tileEntity = tileEntity; }
public ScriptTileEntity(T tileEntity) {
this.tileEntity = tileEntity;
this.world = NpcAPI.Instance().getIWorld(tileEntity.getWorldObj());
}
public int getBlockMetadata(){
return tileEntity.getBlockMetadata();
}
public ScriptWorld getWorld(){
return (ScriptWorld) NpcAPI.Instance().getIWorld((WorldServer) tileEntity.getWorldObj());
public IWorld getWorld(){
return world;
}
public void setWorld(IWorld world) {
this.tileEntity.setWorldObj(world.getMCWorld());
this.world = world;
}
public TileEntity getMCTileEntity() {
return this.tileEntity;
}
public void markDirty()
{
this.tileEntity.markDirty();
}
public void readFromNBT(INbt nbt){
this.tileEntity.readFromNBT(nbt.getMCNBT());
}
@@ -33,8 +45,12 @@ public class ScriptTileEntity<T extends TileEntity> implements ITileEntity {
return this.tileEntity.getDistanceFrom(x,y,z);
}
public double getDistanceFrom(IPos pos){
return this.getDistanceFrom(pos.getX(),pos.getY(),pos.getZ());
}
public IBlock getBlockType(){
return NpcAPI.Instance().getIBlock(tileEntity.getWorldObj(), tileEntity.getBlockType(), new BlockPos(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
return NpcAPI.Instance().getIBlock(world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
}
public boolean isInvalid(){