Function API

Function API

1.4k Downloads

Block activate event not working on Cauldrons

crysthala opened this issue ยท 8 comments

commented

For testing, I have a .json tag pointing to a simple test function cauldron_test that should run say Hi! whenever the cauldron is right-clicked, but nothing happens. I've double-checked that the paths and filenames, etc. are correct, and the corresponding setup for gravel is working perfectly.

I can't find any error messages in it, but here's a latest.log anyway. Starting up MC, loading a world, placing a cauldron, right-clicking it with several objects. (I apologize for all the Optifine spam.)

I'm really enjoying messing around with this mod, and I appreciate all the work you're putting into it! Many thanks. :)

commented

I fixed it in dev, now it should work for every block.

commented

Found it, Cauldrons are just not playing nice. Before I release anything, can you try out other blocks that have a right-click functionality by default? Those may also be bugged, along with any block that already does something on my events.

I can handle them without issues, but I need to know what else might be broken.

commented

Sure, I can do that! Don't mind me, just going to make a little list...

  • Lectern
  • Composter
  • Furnace
  • Blast Furnace
  • Smoker
  • Enchanting Table
  • Chest
  • Barrel
  • Crafting Table
  • Cartography Table
  • Buttons
  • Doors
  • Anvils
  • Beacon
  • Trapdoors
  • Beds
  • Shulker Boxes
  • Brewing Stand
  • Daylight Detector
  • Dispenser
  • Dropper
  • End Portal Frame
  • Ender Chest
  • Flower Pot
  • Grindstone
  • Hopper
  • Jukebox
  • Note Block
  • Lever
  • Loom
  • Comparator
  • Repeater
  • Redstone Ore
  • Scaffolding
  • Sea Pickle
  • Stonecutter
  • Sweet Berry Bush
  • Trapped Chest

I'll test this later tonight and let you know what I find out.

commented

@Frontrider You can use Fabric's UseBlockCallback instead of mixing into Block.activate.

commented

I found the issue! The mixins for block events are on the Block class instead of on BlockState, meaning that any Block subclass that overrides activate without calling super will never call the code.

commented

I'll be going with the blockState route.

commented

The following interactive blocks are unaffected: Scaffolding, End Portal Frame, Redstone Ore, Sea Pickle, and Sweet Berry Bush. All the blocks above with the checkbox ticked are affected by this or a similar issue, as well as Bells and Campfires, which I missed while making that list. If I forgot any others, please let me know and I'll check them as well.

commented

Thank you.