mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
Merge branch 'patch' into dev
# Conflicts: # src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiButton.java # src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiTexturedRect.java # src/main/java/noppes/npcs/client/renderer/customitem/CustomItemRenderer.java
This commit is contained in:
commit
f5ac14b93e
15 files changed
+334
-101
No files matched your search
@@ -250,10 +250,14 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
|
||||
public IBlock getIBlock(IWorld world, IPos pos) {
|
||||
return this.getIBlock(world, pos.getX(),pos.getY(),pos.getZ());
|
||||
return pos == null ? null : this.getIBlock(world, pos.getX(),pos.getY(),pos.getZ());
|
||||
}
|
||||
|
||||
public ITileEntity getITileEntity(IWorld world, IPos pos) {
|
||||
if (pos == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getMCWorld().getTileEntity(pos.getX(), pos.getY(),pos.getZ());
|
||||
return this.getITileEntity(tileEntity);
|
||||
}
|
||||
@@ -284,11 +288,13 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
|
||||
public IPos[] getAllInBox(IPos from, IPos to, boolean sortByDistance) {
|
||||
Iterator<BlockPos> posIterable = BlockPos.getAllInBox(from.getMCPos(),to.getMCPos()).iterator();
|
||||
ArrayList<IPos> list = new ArrayList<>();
|
||||
posIterable.forEachRemaining(BlockPos -> list.add(this.getIPos(BlockPos)));
|
||||
if (sortByDistance) {
|
||||
list.sort(Comparator.comparingDouble(pos -> pos.distanceTo(from)));
|
||||
if (from != null && to != null) {
|
||||
Iterator<BlockPos> posIterable = BlockPos.getAllInBox(from.getMCPos(),to.getMCPos()).iterator();
|
||||
posIterable.forEachRemaining(BlockPos -> list.add(this.getIPos(BlockPos)));
|
||||
if (sortByDistance) {
|
||||
list.sort(Comparator.comparingDouble(pos -> pos.distanceTo(from)));
|
||||
}
|
||||
}
|
||||
return list.toArray(new IPos[0]);
|
||||
}
|
||||
@@ -335,6 +341,9 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
|
||||
public ICustomNpc<?> spawnNPC(IWorld world, IPos pos) {
|
||||
if (pos == null) {
|
||||
return null;
|
||||
}
|
||||
return this.spawnNPC(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user