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:
Luis C.M committed 2023-06-01 16:35:04 -05:00
commit f5ac14b93e
15 files changed
+334 -101

No files matched your search

+14 -5
View File
@@ -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());
}