use of net.minecraft.world.gen.random.ChunkRandom in project skyblock by jsorrell.
the class EndIslandFeatureMixin method generateChorus.
@Inject(method = "generate", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At(value = "INVOKE", target = "Ljava/util/Random;nextInt(I)I", ordinal = 1))
private void generateChorus(FeatureContext<DefaultFeatureConfig> context, CallbackInfoReturnable<Boolean> cir, StructureWorldAccess world, Random random, BlockPos blockPos, float islandSizeF, int level) {
if (SkyBlockSettings.gatewaysSpawnChorus) {
if (level == 0) {
ChunkRandom randomChorus = new ChunkRandom(new AtomicSimpleRandom(0L));
ChunkPos chunkPos = new ChunkPos(blockPos);
randomChorus.setPopulationSeed(world.getSeed(), chunkPos.getStartX(), chunkPos.getStartZ());
int islandRadius = MathHelper.ceil(islandSizeF);
int xOffset = randomChorus.nextInt(2 * islandRadius) - islandRadius;
int farthestZ = MathHelper.floor(Math.sqrt((islandSizeF + 1) * (islandSizeF + 1) - xOffset * xOffset));
int zOffset = randomChorus.nextInt(2 * farthestZ) - farthestZ;
BlockPos chorusPos = blockPos.add(xOffset, 1, zOffset);
Feature.CHORUS_PLANT.generate(new FeatureContext<>(null, world, null, randomChorus, chorusPos, null));
}
}
}
use of net.minecraft.world.gen.random.ChunkRandom in project Astromine by Mixinors.
the class EarthSpaceChunkGenerator method populateNoise.
public void populateNoise(StructureAccessor accessor, Chunk chunk) {
var mutable = new BlockPos.Mutable();
var x1 = chunk.getPos().getStartX();
var z1 = chunk.getPos().getStartZ();
var y1 = 0;
var x2 = chunk.getPos().getEndX();
var z2 = chunk.getPos().getEndZ();
var y2 = 256;
var random = new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed()));
random.setPopulationSeed(this.field_37261, x1, z1);
for (var x = x1; x <= x2; ++x) {
for (var z = z1; z <= z2; ++z) {
for (var y = y1; y <= y2; ++y) {
var noise = this.noise.sample(x, y, z);
noise -= computeNoiseFalloff(y);
if (noise > AMConfig.get().world.asteroidGenerationThreshold) {
if (random.nextInt(64) != 0) {
chunk.setBlockState(mutable.set(x, y, z), AMBlocks.ASTEROID_STONE.get().getDefaultState(), false);
}
}
}
}
}
}
use of net.minecraft.world.gen.random.ChunkRandom in project Illager-Expansion by OhDricky.
the class IllagerFortFeature method canGenerate.
private static boolean canGenerate(StructureGeneratorFactory.Context<StructurePoolFeatureConfig> context) {
ChunkPos chunkPos = context.chunkPos();
int i = chunkPos.x >> 4;
int j = chunkPos.z >> 4;
ChunkRandom chunkRandom = new ChunkRandom(new AtomicSimpleRandom(0L));
chunkRandom.setSeed((long) (i ^ j << 4) ^ context.seed());
chunkRandom.nextInt();
if (chunkRandom.nextInt(5) != 0) {
return false;
}
return !context.chunkGenerator().method_41053(StructureSetKeys.VILLAGES, context.seed(), chunkPos.x, chunkPos.z, 10);
}
use of net.minecraft.world.gen.random.ChunkRandom in project friends-and-foes by Faboslav.
the class IllusionerShackFeature method isSuitableChunk.
private static boolean isSuitableChunk(Context<StructurePoolFeatureConfig> context) {
int i = context.chunkPos().x >> 4;
int j = context.chunkPos().z >> 4;
ChunkRandom chunkRandom = new ChunkRandom(new AtomicSimpleRandom(0L));
chunkRandom.setSeed((long) (i ^ j << 4) ^ context.seed());
chunkRandom.nextInt();
return chunkRandom.nextInt(5) == 0;
}
Aggregations