Jump to content

registerEntityRenderingHandler Bug


Kristopher_RAS

Recommended Posts

Hi, I try to register my entity (I follow a tutorial so just ignore the names I gave to the classes), So I made this class:

 

public class TutorialRenderRegistry {
	public static void registryEntityRender() {
		RenderingRegistry.registerEntityRenderingHandler(TutorialEntity.class, new TutorialEntityRender.RenderFactory());
	}
}

 

but on the registerEntityRenderingHandler function it shows me an error: 

Quote

The method registerEntityRenderingHandler(EntityType<T>, IRenderFactory<? super T>) in the type RenderingRegistry is not applicable for the arguments (Class<TutorialEntity>, TutorialEntityRender.RenderFactory)

I did exactly what he did in the tutorial and it worked for him, why not for me?

 

The Tutorial is with Forge 1.14 me I'm with Forge 1.15 maybe it has been changed in the update but I don't know to resolve it.

 

 

EDIT: I tried with forge for 1.14 and it works perfectly if someone knows what changed in the 1.15 version, how to fix this, maybe it's a bit too soon to 1.15 since it has just been released.

Edited by Kristopher_RAS
Link to comment
Share on other sites

I know about Generics (I'm a C++ programmer for 6 Years now and we have the same things it's called templates, whit few different changes). The problem is that in 1.14 the registerEntityRenderingHandler wasn't required a generics it was asking for an Entity class. Today in 1.15 it asking an EntityType with a generics probably the Entity class but when I'm implementing my EntityType class it still shows me an error. So all I'm asking what they changed between the versions because in 1.14 this worked

 

public class TutorialRenderRegistry {
	public static void registryEntityRender() {
		RenderingRegistry.registerEntityRenderingHandler(TutorialEntity.class, new TutorialEntityRender.RenderFactory());
	}
}

 

Maybe the registerEntityRenderingHandler function is outdated something appeared in 1.15. 

Link to comment
Share on other sites

Okay, so I looked to the source as you asked: 

 

public static <T extends Entity> void registerEntityRenderingHandler(EntityType<T> entityClass, IRenderFactory<? super T> renderFactory)
    {
        INSTANCE.entityRenderers.put(entityClass, renderFactory);
    }

 

It asks for an EntityType<T>  entityClass, so I tried to go give him that: 

 

	public static EntityType<?> tutorial_entity = EntityType.Builder.create(TutorialEntity::new, EntityClassification.CREATURE).build(FirstMod.modid + ":tutorial_entity").setRegistryName(new ResourceLocation(FirstMod.modid, "tutorial_entity"));

 

This is the EnityType defined in another class defined with my EntityClass but it still not working I don't know why. It's possible that I'm missing something really stupid it happened a lot to me.

 

 

I also check the source of the function in 1.14 and it's different:

 

 public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory)
    {
        INSTANCE.entityRenderers.put(entityClass, renderFactory);
    }

 

It asks for a Class<T> entityClass things that I was provided in the previous version (that the guy was doing in his tutorial).

Link to comment
Share on other sites

  • 3 weeks later...

I'm having the same issue and am perhaps not as knowledgeable on the subject. Can someone explain how the error was fixed in a way that is a bit easier to understand? I believe I understand what is wrong, but not how to solve it.

Edited by OneQuestion
  • Like 1
Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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