mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Fixed NullPointerException crash from breaking blocks that have no tile entities.
This commit is contained in:
1 parent
e9a8f8cebc
commit
5cb5770a20
2 files changed
+6
-4
No files matched your search
@@ -171,15 +171,17 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
|
||||
public ITileEntity getITileEntity(IWorld world, IPos pos) {
|
||||
return new ScriptTileEntity<>(world.getMCWorld().getTileEntity(pos.getX(), pos.getY(),pos.getZ()));
|
||||
TileEntity tileEntity = world.getMCWorld().getTileEntity(pos.getX(), pos.getY(),pos.getZ());
|
||||
return this.getITileEntity(tileEntity);
|
||||
}
|
||||
|
||||
public ITileEntity getITileEntity(IWorld world, int x, int y, int z) {
|
||||
return new ScriptTileEntity<>(world.getMCWorld().getTileEntity(x,y,z));
|
||||
TileEntity tileEntity = world.getMCWorld().getTileEntity(x,y,z);
|
||||
return this.getITileEntity(tileEntity);
|
||||
}
|
||||
|
||||
public ITileEntity getITileEntity(TileEntity tileEntity) {
|
||||
return new ScriptTileEntity<>(tileEntity);
|
||||
return tileEntity == null ? null : new ScriptTileEntity<>(tileEntity);
|
||||
}
|
||||
|
||||
public IPos getIPos(BlockPos pos) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ScriptBlock implements IBlock {
|
||||
this.block = block;
|
||||
this.pos = pos;
|
||||
this.bPos = NpcAPI.Instance().getIPos(pos);
|
||||
this.tile = new ScriptTileEntity<>(world.getTileEntity(pos.getX(),pos.getY(), pos.getZ()));
|
||||
this.tile = NpcAPI.Instance().getITileEntity(world.getTileEntity(pos.getX(),pos.getY(), pos.getZ()));
|
||||
}
|
||||
|
||||
public IPos getPos() {
|
||||
|
||||
Reference in new issue
Block a user