Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.16] Steve spawns in the custom biome if though it isn't set as valid spawn

Featured Replies

Posted

The title is very explanatory, I'd like to know if I'm mistaken about the isValidSpawnBiomeForPlayer(), or if there's something wrong with the code:

@Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModBiomes {

    public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, TutorialMod.MOD_ID);

    public static final RegistryObject<Biome> TEST_BIOME = BIOMES.register("test_biome", () -> Maker.TestBiome());

    @SubscribeEvent
    public static void setupBiomes(FMLCommonSetupEvent event) {
        event.enqueueWork(() ->
            setupBiome(TEST_BIOME.get(), BiomeManager.BiomeType.WARM, 1500,
                Type.FOREST, Type.COLD, Type.OVERWORLD, Type.WET)
        );
    }

    private static void setupBiome(Biome biome, BiomeManager.BiomeType biomeType, int weight, BiomeDictionary.Type... types) {
        RegistryKey<Biome> key = RegistryKey.getOrCreateKey(
            ForgeRegistries.Keys.BIOMES,
            Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome), "Biome registry name was null"));

        BiomeDictionary.addTypes(key, types);
        BiomeManager.addBiome(biomeType, new BiomeManager.BiomeEntry(key, weight));
    }

    private static class Maker {

        private static MobSpawnInfo.Builder getStandardMobSpawnBuilder() {
            MobSpawnInfo.Builder mobspawninfo$builder = new MobSpawnInfo.Builder();
            DefaultBiomeFeatures.withPassiveMobs(mobspawninfo$builder);
            DefaultBiomeFeatures.withBatsAndHostiles(mobspawninfo$builder);
            return mobspawninfo$builder;
        }

        private static Biome TestBiome() {
            BiomeGenerationSettings genset = new BiomeGenerationSettings.Builder()
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243767_a)
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243768_b)
                .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.FANCY_OAK)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_COAL)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_GOLD)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_IRON)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_DIAMOND)
                .withStructure(StructureFeatures.END_CITY)
                .withSurfaceBuilder(ConfiguredSurfaceBuilders.field_244178_j)
                .build();

            MobSpawnInfo mobSpawn = getStandardMobSpawnBuilder().copy();

            BiomeAmbience ambience = new BiomeAmbience.Builder()
                .withGrassColor(0xDA67C1)
                .setFogColor(0xEEEEEE)
                .setWaterColor(0xCF21B8)
                .setWaterFogColor(0xCF78C5)
                .withSkyColor(0xE83452)
                .withFoliageColor(0xCA57C1)
                .build();

            return new Biome.Builder()
                .category(Biome.Category.FOREST)
                .withTemperatureModifier(Biome.TemperatureModifier.NONE)
                .withGenerationSettings(genset)
                .withMobSpawnSettings(mobSpawn)
                .depth(0.123f)
                .scale(0.4f)
                .downfall(.4f)
                .precipitation(Biome.RainType.SNOW)
                .temperature(.8f)
                .setEffects(ambience)
                .build();
        }
    }
}

ย 

Edited by kiou.23

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.