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.

Featured Replies

Posted

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.

 

  • Author

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

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.

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.