Jump to content

Get furnace block given FurnaceFuelBurnTimeEvent?


PortsNotAlt

Recommended Posts

Hey all! I asked around on the discord and didn't get any answers over the last couple of days so I'm coming here:

I want to, when my item is used in the furnace as a fuel source, run some action on the actual furnace block. I got far enough that I created a handler class that listens for FurnaceFuelBurnTimeEvent however, that doesn't have any ways to get the position or block of the furnace, any suggestions on how I could accomplish this?

Running forge 46.0.14 for Minecraft 1.20

Link to comment
Share on other sites

This would not be possible with the event as that event is not sensitive to any specific position. This is primarily because places such as AbstractFurnaceMenu#isFuel doesn't have access to that.

Your best bet therefore would be to write 3 mixins, all into AbstractFurnaceBlockEntity that target the 3 usages of ForgeHooks.getBurnTime (that's the method that fires the event). This would give you access to the BlockEntity (self).

  • AbstractFurnaceBlockEntity#getBurnDuration(ItemStack)
  • AbstractFurnaceBlockEntity#isFuel(ItemStack)
  • AbstractFurnaceBlockEntity#canPlaceItem(int, ItemStack)


Just note that there are a few problems with this approach, primarily that AbstractFurnaceMenu#isFuel would disregard your changes. But you also have to consider that any mods which utilise ForgeHooks.getBurnTime (and therefore fire the FurnaceFuelBurnTimeEvent), would also not be subject to your changes.

Edited by TurtyWurty
Forgot to list the 3 usages
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
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.