Jump to content

Recommended Posts

Posted

In an attempt to add a new value for EnumCreatureType, Minecraft crashed. The line adding the type is:

 

public static final EnumCreatureType ambientWater = EnumHelper.addCreatureType("ambientWaterFish", EntityWaterMob.class, 40, Material.water, false);

 

Here is a link to the Crash report: https://gist.github.com/Azaka7/9679277

 

I originally encountered this problem when modding for MC 1.6.4, and had hoped it was fixed for 1.7.2, but that's not the case. It's the same crash for both versions. I have been looking around the coding and I see no reason why this would cause a crash, but creating a custom armor material would not. It appears that Forge is feeding the constructor 2 unnecessary arguments.

 

My reason to create this creature type is to be able to populate the ocean with very basic fish without spawn rates limited to that of squid and lobster (lobster is a water-type creature I've created).

 

Does anyone know why this is happening? Do I need to do something different for custom creature types, or should I report this as a bug with Forge?

Posted

Actually, Forge is missing an argument (isAnimal).

Just use this:

private static final Class<?>[][] paramTypes = new Class[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}};
public static final EnumCreatureType ambientWater = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "ambientWaterFish", EntityWaterMob.class, 40, Material.water, false, true);

instead of:

public static final EnumCreatureType ambientWater = EnumHelper.addCreatureType("ambientWaterFish", EntityWaterMob.class, 40, Material.water, false);

 

The last parameter, as previously suggested, means isAnimal. Set it to true/false accordingly

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.