mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 10:44:46 +00:00
IPos:
-Added crossProduct(IPos), divide(scalar), and to/FromLong functions. NpcAPI: -Added getAllInBox(from,to) IBlock: -Added setPosition functions IBlock, IPos, IEntity, IWorld: -Added a readable toString() function
This commit is contained in:
1 parent
084e6e4149
commit
c8a8e866cb
10 files changed
+191
-25
No files matched your search
@@ -20,10 +20,10 @@ import noppes.npcs.util.LRUHashMap;
|
||||
|
||||
public class ScriptBlock implements IBlock {
|
||||
private static final Map<String, IBlock> blockCache = new LRUHashMap(400);
|
||||
protected final IWorld world;
|
||||
protected final Block block;
|
||||
protected final BlockPos pos;
|
||||
protected final IPos bPos;
|
||||
protected IWorld world;
|
||||
protected Block block;
|
||||
protected BlockPos pos;
|
||||
protected IPos bPos;
|
||||
protected ITileEntity tile;
|
||||
|
||||
public ScriptBlock(World world, Block block, BlockPos pos) {
|
||||
@@ -34,10 +34,56 @@ public class ScriptBlock implements IBlock {
|
||||
this.tile = NpcAPI.Instance().getITileEntity(world.getTileEntity(pos.getX(),pos.getY(), pos.getZ()));
|
||||
}
|
||||
|
||||
public IPos getPosition() {
|
||||
return this.bPos;
|
||||
}
|
||||
|
||||
public IPos getPos() {
|
||||
return this.bPos;
|
||||
}
|
||||
|
||||
public boolean setPosition(IPos pos, IWorld world) {
|
||||
if (pos == null || world == null || !world.setBlock(pos, this))
|
||||
return false;
|
||||
|
||||
this.world.removeBlock(this.getPos());
|
||||
this.world = world;
|
||||
|
||||
this.block = world.getBlock(pos).getMCBlock();
|
||||
this.pos = pos.getMCPos();
|
||||
this.bPos = pos;
|
||||
this.tile = NpcAPI.Instance().getITileEntity(world.getMCWorld().getTileEntity(pos.getX(),pos.getY(),pos.getZ()));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean setPosition(IPos pos) {
|
||||
return this.setPosition(pos,world);
|
||||
}
|
||||
|
||||
public boolean setPos(IPos pos, IWorld world) {
|
||||
return this.setPosition(pos,world);
|
||||
}
|
||||
|
||||
public boolean setPos(IPos pos) {
|
||||
return this.setPosition(pos);
|
||||
}
|
||||
|
||||
public boolean setPosition(int x, int y, int z, IWorld world) {
|
||||
return this.setPos(NpcAPI.Instance().getIPos(x,y,z),world);
|
||||
}
|
||||
|
||||
public boolean setPosition(int x, int y, int z) {
|
||||
return this.setPos(NpcAPI.Instance().getIPos(x,y,z));
|
||||
}
|
||||
|
||||
public boolean setPos(int x, int y, int z, IWorld world) {
|
||||
return this.setPosition(x,y,z, world);
|
||||
}
|
||||
|
||||
public boolean setPos(int x, int y, int z) {
|
||||
return this.setPosition(x,y,z);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.pos.getX();
|
||||
}
|
||||
@@ -148,4 +194,8 @@ public class ScriptBlock implements IBlock {
|
||||
public boolean canCollide() {
|
||||
return canCollide(0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.getName() + " @" + this.getPos() + (world == null ? "" : " in DIM" + world.getDimensionID());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user