Jump to content

Recommended Posts

Posted (edited)

I've been having issues trying to render an entity. I believe I've narrowed the issue down to either my custom item class or my custom entity class. So I've been looking at the EntitySnowball.java as a reference. The only difference I see is the snowball entity class has a method that registers a data fix to the snowball. Can someone explain what "registerFixesThrowable()" does and what a DataFixer is and its purpose?

 

// In EntitySnowball.java
public static void registerFixesSnowball(DataFixer fixer)
{
	EntityThrowable.registerFixesThrowable(fixer, "Snowball");
}

 

But funny enough, if you look inside EntityThrowable.java to see the "registerFixesThrowable()" method, it's empty...

 

// In EntityThrowable.java
public static void registerFixesThrowable(DataFixer fixer, String name)
{
}

 

 

I was confused by this but I decided to look up the call hierarchy for "registerFixesSnowball()". And "registerFixesSnowball()" gets called in DataFixesManager.java which calls a LOT of other entity fixes (which I will remove from the code block for readability purposes).

 

// In DataFixesManager.java
public static DataFixer createFixer()
    {
        DataFixer datafixer = new DataFixer(922);
        datafixer = new net.minecraftforge.common.util.CompoundDataFixer(datafixer);
        WorldInfo.registerFixes(datafixer);
        EntityPlayerMP.func_191522_a(datafixer);
        EntityPlayer.registerFixesPlayer(datafixer);
        AnvilChunkLoader.registerFixes(datafixer);
        ItemStack.registerFixes(datafixer);
        Template.registerFixes(datafixer);
        Entity.registerFixes(datafixer);
        EntityArmorStand.registerFixesArmorStand(datafixer);
	// ...
        EntitySnowball.registerFixesSnowball(datafixer);
	// ...
        registerFixes(datafixer);
        return datafixer;
    }

 

 

This "createFixer()" gets called in "main()" method of MinecraftServer.java and in the CONSTRUCTOR of Minecraft.java

Edited by Sack Of Potatoes
Posted
23 hours ago, diesieben07 said:

DataFixers are basically converters for old save formats. They convert the old NBT data to the new format when you load an old world.

 

As for your error: Show your entity, your renderer and where you register them.

 

I have a thread for the issue here. The renderer is called in client.java preinit() and everything else is in the commonproxy

 

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.