Jump to content

Recommended Posts

Posted

I noticed this warning for the first time today:

RenderEntityKeese.java:48: warning: getEntityTexture (Entity) in RenderEntitykeese overrides getEntityTexture(Entity) in RenderBat; overridden method is a bridge method
     protected ResourceLocation getEntityTexture(Entity entity) {

 

Code responsible:

// RenderEntityKeese extends RenderBat
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return getEntityTexture((EntityKeese) entity); // this is exactly the same as how RenderBat overrides getEntityTexture
}

 

Which got me reading about bridge methods and type erasure, here, here, and here.

 

I tried various things to see if I could get the warning to go away to no avail. Everything seems to work fine, but I don't like getting warnings :P

 

Is this something I can 'fix', or is it not an issue?

Posted

Ah, that makes sense. For whatever reason, I didn't put 2 and 2 together.

 

I was able to fix all but one of the warnings that way: I have a class that extends EntityVillager and overrides createChild(EntityAgeable), but I cannot change the parameter type without the method signature failing.

@Override
public EntityGoron createChild(EntityAgeable entity) {
EntityGoron goron = new EntityGoron(worldObj);
goron.onSpawnWithEgg(null);
goron.updateEntityAttributes(true);
return goron;
}

Posted

Uh, but that's not a generic parameter as far as I can tell. Just using the EntityAgeable version should be fine.

In this case it's not a generic parameter, it's the covariant return type that is causing the bridge method to be created, but changing the return type to EntityVillager (or worse, EntityAgeable), even if it were an option, simply does not work to remove the warning.

 

If only I could magically absorb all knowledge of the JVM and javac... :\

Posted

Ah, right. Well, the bridge method in EntityVillager is called func_180488_b, so that's what you have to override.

 

Edit: Err... *non-bridge.

Hm, in 1.8 yes, but in 1.7.10 the EntityVillager#createChild implementation doesn't call any other methods.

 

Well, I'll just ignore that one, then, since there doesn't seem to be anything to do about it until I update to 1.8. Thanks for the help!

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.

Announcements



×
×
  • Create New...

Important Information

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