Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding new valid blocks to TileEntityType registry?


InspectorCaracal
 Share

Recommended Posts

I'm making my own beehives and I want to create them with the vanilla BeehiveBlock and BeehiveTileEntity classes. I've gotten it 99% working, except that when I place my custom hive, I get a warning and bees don't seem to recognize it (indicating there's no valid beehive te present).

[minecraft/TileEntity]: Block entity invalid: minecraft:beehive @ BlockPos{x=-232, y=65, z=60}

I'm not clear on why exactly this is happening, but my best guess is that it's due to the BeehiveTileEntity initially being registered with the bee nest and beehive blocks:

public static final TileEntityType<BeehiveTileEntity> BEEHIVE = register("beehive", TileEntityType.Builder.create(BeehiveTileEntity::new, Blocks.BEE_NEST, Blocks.BEEHIVE));

 

I've tried registering it with my own block in my registry class according to the TileEntityType registry docs and examples, but it didn't seem to affect anything. Is there a different syntax for adding new valid blocks to an already registered TileEntityType?

 

edit: I should specify, the BeehiveTileEntity class has TileEntityType.BEEHIVE hardcoded into the constructor, which is likely what's complicating things.

Edited by InspectorCaracal
Link to comment
Share on other sites

Well, that fix handles the specific problem I was having in regards to the constructor re: inheritance, but I'll be damned if I make another thread again at this point so my last remaining problem (optimistically) which I hunted down trying to figure it out is that the bees will only identify a hive as a valid potential target if they're BEEHIVE or BEE_NEST in the PointOfInterestType registry.

Is there something else I can overload somewhere to get my hives in there?

Edited by InspectorCaracal
thought something might work but it won't
Link to comment
Share on other sites

13 hours ago, diesieben07 said:

You can set PointOfInterestType#matchingStates using reflection. Do this in FMLCommonSetupEvent#enqueueWork.

By PointOfInterestType#matchingStates do you mean the variable holding the registered POI type?

Edited by InspectorCaracal
why did i think it was a method
Link to comment
Share on other sites

8 hours ago, InspectorCaracal said:

Tangentially, I just found this thread while researching to make sure I do the enqueueWork bit properly and I got to "Vanilla loves hardcoding things" and BOY is that the theme of my past week working on this lmfaooo

Custom signs have been improved, there are now hooks in place to make them work better.

Link to comment
Share on other sites

11 hours ago, diesieben07 said:

It's a field. You have to set it using reflection because it is private.

Sorry, I'm not very good at keeping track of specific terminology and tend to just throw the closest word I can think of at it. Anyway, let me rephrase my question a little more clearly.

Is the thing I'm supposed to modify a field called "matchingStates", or is it the field called "BEEHIVE"? I assumed you meant matchingStates at first, but there's no field by that name or even a similar name in PointOfInterestType, or even in the entire code base.

I ran with it being the BEEHIVE field yesterday because I knew where that was, but it didn't work, and I want to find out if that's where you were pointing me before putting more work into figuring out what I might've done wrong.

edit: Oh, it just occurred to me while looking at the fields again that you might've meant `Set<BlockState> blockStates` so I'm going to give that one a shot

Edited by InspectorCaracal
Link to comment
Share on other sites

12 hours ago, InspectorCaracal said:

edit: Oh, it just occurred to me while looking at the fields again that you might've meant `Set<BlockState> blockStates` so I'm going to give that one a shot

You're still on MCP mappings then. Recent versions of Forge use official mappings.

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.