Jump to content

[1.15.2] EntityType.Builder.create not working


Bieging

Recommended Posts

Hello,

 

I'm following Harry Talks 1.14 modding tutorial and got stuck on the Entities part.

 

When defining an entity, I got an error in the function EntityType.Builder.create, that tells "The type TutorialEntity does not define TutorialEntity(EntityType<T>, World) that is applicable here".

 

Code for both classes below

 

TutorialEntities.java

 

import bieg.tutorialmod.TutorialModRegistries;
import bieg.tutorialmod.entities.TutorialEntity;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraftforge.event.RegistryEvent;

public class TutorialEntities
{
	public static EntityType<? extends CreatureEntity> TUTORIAL_ENTITY = EntityType.Builder.create(TutorialEntity::new, EntityClassification.CREATURE).build(TutorialMod.modid + ":tutorial_entity").setRegistryName(TutorialModRegistries.location("tutorial_entity"));
	
	public static void registerEntitySpawnEggs(final RegistryEvent.Register<Item> event)
	{
		event.getRegistry().registerAll
		(
			ItemList.tutorial_entity_egg = registerEntitySpawnEgg(TUTORIAL_ENTITY, 0x32a852, 0x30407a, "tutorial_entity_egg")
		);
	}
	
	public static void registerEntityWorldSpawns()
	{
		registerEntityWorldSpawn(TUTORIAL_ENTITY, Biomes.PLAINS, Biomes.BEACH, Biomes.JUNGLE);
	}
	
	public static Item registerEntitySpawnEgg(EntityType<?> type, int color1, int color2, String name)
	{
		SpawnEggItem item = new SpawnEggItem(type, color1, color2, new Item.Properties().group(TutorialModRegistries.tutorialGroup));
		
		item.setRegistryName(TutorialModRegistries.location(name));
		
		return item;
	}
	
	public static void registerEntityWorldSpawn(EntityType<?> entity, Biome... biomes)
	{
		for (Biome biome : biomes)
		{
			if (biome != null)
			{
				biome.getSpawns(entity.getClassification()).add(new Biome.SpawnListEntry(entity, 10, 1, 10));
			}
		}
	}
}

 

TutorialEntity.java

 

import bieg.tutorialmod.lists.TutorialEntities;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
import net.minecraft.entity.ai.goal.RandomWalkingGoal;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.world.World;

public class TutorialEntity extends CreatureEntity
{

	@SuppressWarnings("unchecked")
	protected TutorialEntity(EntityType<? extends CreatureEntity> type, World worldIn)
	{
		super((EntityType<? extends CreatureEntity>) TutorialEntities.TUTORIAL_ENTITY, worldIn);
	}

	@Override
	protected void registerGoals()
	{
		this.goalSelector.addGoal(0, new SwimGoal(this));
		this.goalSelector.addGoal(0, new RandomWalkingGoal(this, 1.2d));
		this.goalSelector.addGoal(0, new LookRandomlyGoal(this));
	}
	
	@Override
	protected void registerAttributes()
	{
		this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0d);
		this.getAttribute(SharedMonsterAttributes.ATTACK_SPEED).setBaseValue(2.0d);
	}
}

 

Is it something in the new version of Forge?

 

Best regards.

 

Link to comment
Share on other sites

I'm actually completely new to modding. Could you help with where I use the DeferredRegister? Or any guide that shows how to use it?

 

Any suggestions to good tutorials that teach how to start modding the best way?

 

Thanks for the reply.

Edited by Bieging
Link to comment
Share on other sites

14 minutes ago, Bieging said:

I'm actually completely new to modding. Could you help with where I use the DeferredRegister? Or any guide that shows how to use it?

 

Any suggestions to good tutorials that teach how to start modding the best way?

 

Thanks for the reply.

Reading the official forge docs can be quite helpful. It doesn't cover absolutely everything, but it covers most stuff you need and for the most part it's detailed info.

 

As for tutorials, Cadiboo probably has the most in-depth tutorials so I recommend following that. As far as I am aware his github repo has more stuff than what is covered in the website, so check that out too.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.



×
×
  • Create New...

Important Information

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