Jump to content

Custom Spawn for entities


OrcaWorld
 Share

Recommended Posts

Note:

I looked at Blaze's AI and I didn't find any special for it , but I'll continue to fix my entity. Now return to my problem.

 

So I wanted to made for all my Entity Natural Spawn. I tried 1.14-1.15 (and early 1.16) method , but for some reason it doesn't work :c

 

Cannot resolve method - writes me. I'm seriously don't know which method I need to replace with wrong methods. Does anyone knows?

 

A! Here's my EntityInit

 

 

package com.orca.kikoriki;

import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class EntityInit {

    public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, KikorikiMain.MOD_ID);

    public static final RegistryObject<EntityType<KrashEntity>> KRASH = ENTITY_TYPES.register("krash",
            () -> EntityType.Builder.create(KrashEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "krash").toString()));

    public static final RegistryObject<EntityType<ChickoEntity>> CHICKO = ENTITY_TYPES.register("chicko",
            () -> EntityType.Builder.create(ChickoEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "chicko").toString()));

    public static final RegistryObject<EntityType<CarlinEntity>> CARLIN = ENTITY_TYPES.register("carlin",
            () -> EntityType.Builder.create(CarlinEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "carlin").toString()));

    public static final RegistryObject<EntityType<OlgaEntity>> OLGA = ENTITY_TYPES.register("olga",
            () -> EntityType.Builder.create(OlgaEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "carlin").toString()));

    public static final RegistryObject<EntityType<MoleEntity>> MOLE = ENTITY_TYPES.register("mole",
            () -> EntityType.Builder.create(MoleEntity::new, EntityClassification.CREATURE)
                    .size(0.4f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "mole").toString()));

    public static final RegistryObject<EntityType<RosaEntity>> ROSA = ENTITY_TYPES.register("rosa",
            () -> EntityType.Builder.create(RosaEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "rosa").toString()));

    public static final RegistryObject<EntityType<WalleyEntity>> WALLEY = ENTITY_TYPES.register("walley",
            () -> EntityType.Builder.create(WalleyEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "walley").toString()));

    public static final RegistryObject<EntityType<KopatuchEntity>> KOPATUCH = ENTITY_TYPES.register("kopatuch",
            () -> EntityType.Builder.create(KopatuchEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "kopatuch").toString()));

    public static final RegistryObject<EntityType<DokkoEntity>> DOKKO = ENTITY_TYPES.register("dokko",
            () -> EntityType.Builder.create(DokkoEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "dokko").toString()));

    public static final RegistryObject<EntityType<PinEntity>> PIN = ENTITY_TYPES.register("pin",
            () -> EntityType.Builder.create(PinEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "pin").toString()));

    public static final RegistryObject<EntityType<FishEntity>> FISH = ENTITY_TYPES.register("fish",
            () -> EntityType.Builder.create(FishEntity::new, EntityClassification.WATER_CREATURE)
                    .size(0.3f, 0.2f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "fish").toString()));

    public static final RegistryObject<EntityType<ButterFlyEntity>> BUTTERFLY = ENTITY_TYPES.register("butterfly",
            () -> EntityType.Builder.create(ButterFlyEntity::new, EntityClassification.AMBIENT)
                    .size(0.4f, 0.2f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "butterfly").toString()));

    public static final RegistryObject<EntityType<CatterPillarEntity>> CATTERPILLAR = ENTITY_TYPES.register("catterpillar",
            () -> EntityType.Builder.create(CatterPillarEntity::new, EntityClassification.CREATURE)
                    .size(0.4f, 0.1f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "catterpillar").toString()));

    public static final RegistryObject<EntityType<FrogEntity>> FROG = ENTITY_TYPES.register("frog",
            () -> EntityType.Builder.create(FrogEntity::new, EntityClassification.CREATURE)
                    .size(0.3f, 0.4f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "frog").toString()));

    public static final RegistryObject<EntityType<IronNurseEntity>> IRON_NURSE = ENTITY_TYPES.register("iron_nurse",
            () -> EntityType.Builder.create(IronNurseEntity::new, EntityClassification.MONSTER)
                    .size(1.0f, 2.0f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "iron_nurse").toString()));

    public static final RegistryObject<EntityType<GiantButterFlyEntity>> GIANT_BUTTERFLY = ENTITY_TYPES.register("giant_butterfly",
            () -> EntityType.Builder.create(GiantButterFlyEntity::new, EntityClassification.MONSTER)
                    .size(3.0f, 1.0f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "giant_butterfly").toString()));

    public static final RegistryObject<EntityType<BBEntity>> BB = ENTITY_TYPES.register("bb",
            () -> EntityType.Builder.create(BBEntity::new, EntityClassification.CREATURE)
                    .size(0.6f, 0.6f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "bb").toString()));

    public static final RegistryObject<EntityType<DemonEntity>> DEMON = ENTITY_TYPES.register("demon",
            () -> EntityType.Builder.create(DemonEntity::new, EntityClassification.MONSTER)
                    .size(2.0f, 4.0f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "demon").toString()));

    public static final RegistryObject<EntityType<WhaleEntity>> WHALE = ENTITY_TYPES.register("whale",
            () -> EntityType.Builder.create(WhaleEntity::new, EntityClassification.WATER_CREATURE)
                    .size(6.0f, 3.0f)
                    .build(new ResourceLocation(KikorikiMain.MOD_ID, "whale").toString()));

    public static void registerEntityWorldSpawns()
    {
        registerEntityWorldSpawn(KRASH, Biomes.PLAINS, Biomes.FOREST);
    }

    public static void registerEntityWorldSpawn(EntityType<?> entity, Biome... biomes)
    {
        for(Biome biome : biomes) {
            if (biome != null) {
                biome.getSpawns(entity.getClassification()).add(new SpawnListEntry(entity, 20, 1, 10));
            }
        }
    }
}

 

I have problems with getSpawns and SpawnListEntry.

Link to comment
Share on other sites

1 hour ago, OrcaWorld said:

registerEntityWorldSpawn(KRASH, Biomes.PLAINS, Biomes.FOREST);

First, this is taking in a registry object when it requires an entity type.

Second, this looks like that the call in a parallel event will not be deferred, so defer it properly within a DeferredWorkQueue (assuming this is 1.15).

Edited by ChampionAsh5357
Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

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