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.2] What is a DataFixer (related to Entities)?

Featured Replies

Posted

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

  • Author
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...

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.