use of net.minecraft.world.level.levelgen.LegacyRandomSource in project RepurposedStructures by TelepathicGrunt.
the class FillEndPortalFrameProcessor method processBlock.
@Override
public StructureTemplate.StructureBlockInfo processBlock(LevelReader worldView, BlockPos pos, BlockPos blockPos, StructureTemplate.StructureBlockInfo structureBlockInfoLocal, StructureTemplate.StructureBlockInfo structureBlockInfoWorld, StructurePlaceSettings structurePlacementData) {
if (structureBlockInfoWorld.state.is(Blocks.END_PORTAL_FRAME)) {
BlockPos worldPos = structureBlockInfoWorld.pos;
Random random = new WorldgenRandom(new LegacyRandomSource(0L));
random.setSeed(worldPos.asLong() * worldPos.getY());
return new StructureTemplate.StructureBlockInfo(structureBlockInfoWorld.pos, structureBlockInfoWorld.state.setValue(EndPortalFrameBlock.HAS_EYE, random.nextFloat() < probability), structureBlockInfoWorld.nbt);
}
return structureBlockInfoWorld;
}
use of net.minecraft.world.level.levelgen.LegacyRandomSource in project RepurposedStructures by TelepathicGrunt.
the class SpawnerRandomizingProcessor method processBlock.
@Override
public StructureTemplate.StructureBlockInfo processBlock(LevelReader worldView, BlockPos pos, BlockPos blockPos, StructureTemplate.StructureBlockInfo structureBlockInfoLocal, StructureTemplate.StructureBlockInfo structureBlockInfoWorld, StructurePlaceSettings structurePlacementData) {
if (structureBlockInfoWorld.state.getBlock() instanceof SpawnerBlock) {
BlockPos worldPos = structureBlockInfoWorld.pos;
Random random = new WorldgenRandom(new LegacyRandomSource(0L));
random.setSeed(worldPos.asLong() * worldPos.getY());
CompoundTag spawnerNBT = SetMobSpawnerEntity(random, structureBlockInfoWorld.nbt);
if (spawnerNBT == null) {
return new StructureTemplate.StructureBlockInfo(worldPos, Blocks.AIR.defaultBlockState(), null);
} else {
return new StructureTemplate.StructureBlockInfo(worldPos, structureBlockInfoWorld.state, spawnerNBT);
}
}
return structureBlockInfoWorld;
}
use of net.minecraft.world.level.levelgen.LegacyRandomSource in project bygone-nether by izofar.
the class CitadelStructure method checkChunk.
private static boolean checkChunk(PieceGeneratorSupplier.Context<JigsawConfiguration> context) {
WorldgenRandom worldgenrandom = new WorldgenRandom(new LegacyRandomSource(0L));
worldgenrandom.setLargeFeatureSeed(context.seed(), context.chunkPos().x, context.chunkPos().z);
return context.validBiome().test(context.chunkGenerator().getNoiseBiome(QuartPos.fromBlock(context.chunkPos().getMiddleBlockX()), QuartPos.fromBlock(64), QuartPos.fromBlock(context.chunkPos().getMiddleBlockZ())));
}
Aggregations