Java Code Examples for net.minecraft.world.biome.Biome#SpawnEntry

The following examples show how to use net.minecraft.world.biome.Biome#SpawnEntry . 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: OverworldChunkGeneratorMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Inject(
        method = "getEntitySpawnList",
        at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
                target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;)Z"),
        cancellable = true
)
private void onGetEntitySpawnList(EntityCategory category, BlockPos pos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
    if (CarpetExtraSettings.straySpawningInIgloos)
    {
        if (Feature.IGLOO.isApproximatelyInsideStructure(this.world, pos))
        {
            cir.setReturnValue(Feature.IGLOO.getMonsterSpawns());
        }
    }
    
    if (CarpetExtraSettings.creeperSpawningInJungleTemples)
    {
        if (Feature.JUNGLE_TEMPLE.isApproximatelyInsideStructure(this.world, pos))
        {
            cir.setReturnValue(Feature.JUNGLE_TEMPLE.getMonsterSpawns());
        }
    }
}
 
Example 2
Source File: MoonChunkGenerator.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
    if (group == SpawnGroup.MONSTER) {
        if (accessor.method_28388(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) {
            return StructureFeature.PILLAGER_OUTPOST.getMonsterSpawns();
        }
    }

    return super.getEntitySpawnList(biome, accessor, group, pos);
}
 
Example 3
Source File: JungleTempleFeature_creeperMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getMonsterSpawns()
{
    if (CarpetExtraSettings.creeperSpawningInJungleTemples)
    {
        return MONSTER_SPAWNS;
    }
    return Collections.emptyList();
}
 
Example 4
Source File: IglooFeatureMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getMonsterSpawns()
{
    if (CarpetExtraSettings.straySpawningInIgloos)
    {
        return MONSTER_SPAWNS;
    }
    return Collections.emptyList();
}
 
Example 5
Source File: WorldEvents.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static List<Biome.SpawnEntry> getPotentialSpawns(IWorld world, EntityCategory type, BlockPos pos, List<Biome.SpawnEntry> oldSpawns) {
	WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldSpawns);

	if (MinecraftForge.EVENT_BUS.post(event)) {
		return Collections.emptyList();
	}

	return event.getList();
}
 
Example 6
Source File: OverworldChunkGeneratorMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
        target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;)Z"),
        cancellable = true)
private void onGetEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1,
        CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
    if (CarpetSettings.huskSpawningInTemples)
    {
        if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, blockPos_1))
        {
            cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
        }
    }
}
 
Example 7
Source File: EndCityFeatureMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getMonsterSpawns()
{
    if (CarpetSettings.shulkerSpawningInEndCities)
        return spawnList;
    return Collections.emptyList();
}
 
Example 8
Source File: DesertPyramidFeatureMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getMonsterSpawns()
{
    if (CarpetSettings.huskSpawningInTemples)
    {
        return MONSTER_SPAWNS;
    }
    return Collections.emptyList();
}
 
Example 9
Source File: FloatingIslandsChunkGeneratorMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1)
{
    if (CarpetSettings.shulkerSpawningInEndCities && EntityCategory.MONSTER == entityCategory_1)
    {
        if (Feature.END_CITY.isInsideStructure(this.world, blockPos_1))
        {
            return Feature.END_CITY.getMonsterSpawns();
        }
    }
    return this.world.getBiome(blockPos_1).getEntitySpawnList(entityCategory_1);
}
 
Example 10
Source File: HallowedChunkGenerator.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory category, BlockPos pos) {
	// Custom feature spawn stuff goes here

	return super.getEntitySpawnList(category, pos);
}
 
Example 11
Source File: MixinSpawnHelper.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@ModifyVariable(method = "method_8664", at = @At(value = "INVOKE", target = "java/util/List.isEmpty ()Z", shift = At.Shift.BEFORE))
private static List<Biome.SpawnEntry> hookRandomSpawn(List<Biome.SpawnEntry> oldSpawns, ChunkGenerator<?> chunkGenerator, EntityCategory entityCategory, Random random, BlockPos blockPos) {
	IWorld world = ((MixinChunkGenerator) chunkGenerator).getWorld();

	return WorldEvents.getPotentialSpawns(world, entityCategory, blockPos, oldSpawns);
}
 
Example 12
Source File: MixinSpawnHelper.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@ModifyVariable(method = "method_8659", at = @At(value = "INVOKE", target = "java/util/List.isEmpty ()Z", shift = At.Shift.BEFORE))
private static List<Biome.SpawnEntry> hookCanSpawn(List<Biome.SpawnEntry> oldSpawns, ChunkGenerator<?> chunkGenerator, EntityCategory entityCategory, Biome.SpawnEntry spawnEntry, BlockPos blockPos) {
	IWorld world = ((MixinChunkGenerator) chunkGenerator).getWorld();

	return WorldEvents.getPotentialSpawns(world, entityCategory, blockPos, oldSpawns);
}
 
Example 13
Source File: FlatChunkGeneratorMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory category, BlockPos pos)
{
    if (CarpetSettings.flatWorldStructureSpawning)
    {
        if (Feature.SWAMP_HUT.method_14029(this.world, pos))
        {
            if (category == EntityCategory.MONSTER)
            {
                return Feature.SWAMP_HUT.getMonsterSpawns();
            }
    
            if (category == EntityCategory.CREATURE)
            {
                return Feature.SWAMP_HUT.getCreatureSpawns();
            }
        }
        else if (category == EntityCategory.MONSTER)
        {
            if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(this.world, pos))
            {
                return Feature.PILLAGER_OUTPOST.getMonsterSpawns();
            }

            if (CarpetSettings.huskSpawningInTemples)
            {
                if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, pos))
                {
                    return Feature.DESERT_PYRAMID.getMonsterSpawns();
                }
            }
    
            if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(this.world, pos))
            {
                return Feature.OCEAN_MONUMENT.getMonsterSpawns();
            }

            if (Feature.NETHER_BRIDGE.isInsideStructure(this.world, pos))
            {
                return Feature.NETHER_BRIDGE.getMonsterSpawns();
            }

            if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(this.world, pos) && this.world.getBlockState(pos.down(1)).getBlock() == Blocks.NETHER_BRICKS)
            {
                return Feature.NETHER_BRIDGE.getMonsterSpawns();
            }

            if (CarpetSettings.shulkerSpawningInEndCities)
            {
                if (Feature.END_CITY.isInsideStructure(this.world, pos))
                {
                    return Feature.END_CITY.getMonsterSpawns();
                }
            }
        }
    }
    
    return super.getEntitySpawnList(category, pos);
}