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.11] Changes on how to register entities?

Featured Replies

Posted

So, I was checking a mod I had on 1.10.2 and I noticed that something changed on how the entities are registered I assume...

 

The code shows no errors, but the entity spawn is the world as "unknown" and it doesn't render.

 

I can hear it, and it's breaking blocks, I even see the Boss Bar, but I don't see the entity itself.

 

Any clues on what I should look for?

So, I was checking a mod I had on 1.10.2 and I noticed that something changed on how the entities are registered I assume...

 

The code shows no errors, but the entity spawn is the world as "unknown" and it doesn't render.

 

I can hear it, and it's breaking blocks, I even see the Boss Bar, but I don't see the entity itself.

 

Any clues on what I should look for?

Post code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

This is what I'm doing:

 

public class ModEntities {


public static void init(){

	createEntity(MyDragon.class, 1513, "my_dragon", 161425, 1582224);

}


public static void createEntity(Class entityClass, int ID, String entityName, int solidColor, int spotColor){

	EntityRegistry.registerModEntity(entityClass, entityName, ID, IrishLuck.instance, 128, 1, true);
//		EntityRegistry.registerEgg(entityClass, solidColor, spotColor);

}

}

 

That gets called on preInit

 

And the render on the client proxy gets called on init and it is

 

		RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
                
        renderManager.entityRenderMap.put(MyDragon.class, new RenderMyDragon(renderManager));

  • Author

Use

RenderingRegistry.registerEntityRenderingHandler

in preInit from your client proxy to register renderers. Make sure to use the version that is not deprecated.

Thanks. I will start fresh from scratch tomorrow to see what I'm messing here. I tried:

 

        RenderingRegistry.registerEntityRenderingHandler(MyDragon.class, new IRenderFactory<MyDragon>() 
	{
		@Override
		public Render<? super MyDragon> createRenderFor(RenderManager manager) 
		{
			return new RenderMyDragon(manager);
		}
	});

 

And still same problem. For sure I have to implement or extend something new that I'm missing, not sure.

Yeah man I just went to build a snowball and it didn't work.

 

I set up everything according to 1.11 changes

 

entitythrowable --- >entityorb

entitysnowball --- > entitysphere extends entityorb

itemsnowball----> itemsphere

 

I just transfered it over and my entity was invisible, it did however fly and made impact, and I was able to adjust stack size and situate the tab and such. Item with custom json and texture visible both in hand and on ground.

entity can't be found when searching for it in the chat either.

 

I'll just chill for a minute til this is groovy.

Entity Registration has changed A LOT in 1.11.

I am currently trying to decide how to best address it in Forge.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Entity Registration has changed A LOT in 1.11.

I am currently trying to decide how to best address it in Forge.

 

please keep this going, whatever happens. I don't like the jerky entities :[ , Like I can kinda see what they are getting at, but making all the thrown entities derpy would really suck, and doesn't work for projectiles.

EntityRegistry.registerModEntity(128, 214, true);

The reason it doesn't work at all currently is because EntityRegistry.registerModEntity does precisely one thing: nothing.

You have to wait until it is re-implemented.

 

I realize this...  :blank:

  • Author

So I can see one of the Forge updates works on fixing the entities registration.

 

I now have a problem when trying to use this method on the render registry:

 

        RenderingRegistry.registerEntityRenderingHandler(MyDragon.class, new IRenderFactory<MyDragon>() 
	{
		@Override
		public Render<? super MyDragon> createRenderFor(RenderManager manager) 
		{
			return new RenderMyDragon(manager);
		}
	});

 

I just get a white box, however when I use the one I'm using on 1.10.2 it renders ok

 

RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
	renderManager.entityRenderMap.put(MyDragon.class, new RenderMyDragon(renderManager));

 

I'm sure the problem is that when I make the Render implement the IRenderFactory I'm not doing this part correctly:

 

	@Override
public Render createRenderFor(RenderManager manager) {
	// TODO Auto-generated method stub
	return this;
}

 

What should I return on that method?

 

Don't implement

IRenderFactory

on your Renderer.

The easiest way is to have a constructor in your Renderer class that has a

RenderManager

parameter and then use a constructor reference to implement

IRenderFactory

:

 

registerEntityRenderingHandler(MyEntity.class, MyRenderer::new)

 

Any word on items used for spawning things? i.e. eggs, thrownstuff, spawneggs, etc.

Or are the entities only spawnable through world generation (so far)?

 

I see waddles and betterthanbunnies have updated to 1.11. Figured I'd touch base again, since its been a minute.

Any word on items used for spawning things? i.e. eggs, thrownstuff, spawneggs, etc.
Not sure what your question is, spawn eggs should work fine if you are using the methods in EntityRegistry to create them

 

how bout snowballs? or arrows.

What about them?

 

Is it a possibility to register one and throw one now (without the entity being invisible?) Or no....?

 

I've been sitting here looking at my several variations of no error showing code, going "why doesn't this work" Then tearing it down and rebuilding the whole thing again, just to do the same thing. (I've been doing so for 3 days now)

  • 4 months later...

Hey! I know this is old, but it looks like you never got help and I think all you needed was a colon in this line,

private static final ResourceLocation DREK_TEXTURES = new ResourceLocation(References.MOD_ID, "textures/entity/entitydrek.png");

 

You needed it before textures, so it should look like ":textures/entity/entitydrek.png"

11 minutes ago, SirJoseph said:

Hey! I know this is old, but it looks like you never got help and I think all you needed was a colon in this line,

private static final ResourceLocation DREK_TEXTURES = new ResourceLocation(References.MOD_ID, "textures/entity/entitydrek.png");

 

You needed it before textures, so it should look like ":textures/entity/entitydrek.png"

Incorrect. ResourceLocation splits the 2 parameters into domain & path. Manually adding a colon is never necessary unless you use the single parameter constructor, which calls ResourceLocation#splitObjectName, and places each part into the mentioned domain & path.
The way you showed, with an added colon in the path, will become "domain::path".

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

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.