net.minecraft.world.SpawnHelper Java Examples

The following examples show how to use net.minecraft.world.SpawnHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HallowedChunkGenerator.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void populateEntities(ChunkRegion region) {
	int centreX = region.getCenterChunkX();
	int centreZ = region.getCenterChunkZ();
	Biome biome = region.getBiome((new ChunkPos(centreX, centreZ)).getCenterBlockPos());
	ChunkRandom chunkRandom = new ChunkRandom();
	chunkRandom.setSeed(region.getSeed(), centreX << 4, centreZ << 4);
	SpawnHelper.populateEntities(region, biome, centreX, centreZ, chunkRandom);
}
 
Example #2
Source File: ServerChunkManagerMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "method_20801", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/util/math/BlockPos;)V"
))
// inject our repeat of spawns if more spawn ticks per tick are chosen.
private void spawnMultipleTimes(EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
{
    for (int i = 0; i < SpawnReporter.spawn_tries.get(entityCategory_1); i++)
    {
        SpawnHelper.spawnEntitiesInChunk(entityCategory_1, world_1, worldChunk_1, blockPos_1);
    }
}