use of hellfirepvp.astralsorcery.common.util.block.iterator.BlockPositionGenerator in project AstralSorcery by HellFirePvP.
the class CEffectAbstractList method peekNewPosition.
@Nonnull
public Either<T, BlockPos> peekNewPosition(World world, BlockPos pos, ConstellationEffectProperties prop) {
if (this.excludesRitual || this.excludeRitualColumn) {
MiscUtils.executeWithChunk(world, pos, () -> {
this.isLinkedRitual = MiscUtils.getTileAt(world, pos, TileRitualLink.class, true) != null;
});
}
BlockPositionGenerator gen = this.selectPositionStrategy(this.positionStrategy, prop);
if (gen != this.positionStrategy) {
gen.copyFilterFrom(this.positionStrategy);
}
BlockPos at = gen.generateNextPosition(new Vector3(0.5, 0.5, 0.5), prop.getSize());
BlockPos actual = at.add(pos);
if (this.getCount() >= this.maxAmount) {
return Either.right(actual);
}
return MiscUtils.executeWithChunk(world, actual, () -> {
if (this.verifier.test(world, actual, world.getBlockState(actual))) {
T element = this.createElement(world, actual);
if (element == null) {
return Either.right(actual);
} else {
return Either.left(element);
}
}
return Either.right(actual);
}, Either.right(actual));
}
use of hellfirepvp.astralsorcery.common.util.block.iterator.BlockPositionGenerator in project AstralSorcery by HellFirePvP.
the class CEffectFornax method createPositionStrategy.
@Nonnull
@Override
protected BlockPositionGenerator createPositionStrategy() {
BlockPositionGenerator gen = new BlockRandomPositionGenerator();
gen.andFilter(pos -> pos.getY() < 0);
return gen;
}
Aggregations