Jikoo / EnchantableBlocks

A Bukkit plugin adding effects for enchantments on blocks.
https://dev.bukkit.org/projects/enchantableblocks
9 stars 2 forks source link

Enchanted Furnaces won't combine #21

Closed Polar0634 closed 3 years ago

Polar0634 commented 3 years ago

Hi, I've updated the plugin to the latest version, as well as ensuring that the perms were set-up correctly; however, whenever I try and combine 2 furnaces they don't work; it becomes a ghost item, and the old furnaces are returned (without any EXP lost either). Any help will be appreciated, and thanks in advance!

https://user-images.githubusercontent.com/48165254/107439848-a1115c00-6b2a-11eb-8fa6-10da8a795b1c.mp4

Jikoo commented 3 years ago

What is "latest version" - dev build, release? What server version?

Polar0634 commented 3 years ago

Version - EnchantableBlocks 2.0.7 Server Version - paper-1.16.5-466

Sorry for the delayed response

Jikoo commented 3 years ago

Cannot reproduce. Probably a plugin conflict, unfortunately.

Jikoo commented 3 years ago

Unless you can get back to me with what plugin is conflicting, unfortunately there's nothing I can do to help you.

To find plugin conflicts, generally the fastest technique is to eliminate half your plugins at a time, repeating by halves until you find the one that's causing unexpected behavior. You can try to shortcut the process by using EventDebug to see which plugins are modifying the PrepareAnvilEvent, but because an inventory action results in it, pretty much any plugin doing inventory work could be conflicting.

Polar0634 commented 3 years ago

Hi, sorry for leaving this without a response for so long.

I've gone through and found the plugin conflict, GoldenEnchants. Thanks for your advice, it helped me find the issue faster; and once again thanks for the amazing support!

Jikoo commented 3 years ago

Hey, no worries, life gets busy and tracing down plugin conflicts takes a ton of time.

GoldenEnchants looks like it shouldn't be interfering with furnace enchanting - they skip all interactions with non-enchantable items, which traces back to providing Minecraft's internal consideration of whether or not an object is a tool, weapon, or armor. While EB may treat furnaces like tools in terms of enchantments allowed and limitations, it doesn't redefine the furnace as a tool internally - GE should be skipping handling the event. Honestly not sure why that's occurring.

Either way, I think I should be able to circumvent this by setting the slot's content again (I assume that for some reason the result is being recalculated) when the container data for level cost is sent, assuming the contents are still correct at that point.

Polar0634 commented 3 years ago

When I was using the EventDebug tool you suggested, I did notice something which may be the issue; whenever you click on the furnace to be made, it is registered as a LEGACY_AIR block, to begin with; in which, the code here could then be conflicting with. The pastebin shows this, with me only having EnchantableBlocks and EventLogger.

If it was being registered as an Air block, it may be that causing the issue? Not fluent in Java so I can't be sure, but was just something I'd noticed

Jikoo commented 3 years ago

[17:40:36 INFO]: [EventDebug] Event fired: InventoryClickEvent isShiftClick: false getHotbarButton: -1 getCurrentItem: LEGACY_FURNACE(0) x1 getAction: PICKUP_ALL getRawSlot: 2 isRightClick: false getClick: LEFT isLeftClick: true getSlot: 2 getCursor: LEGACY_AIR(-1) x0 getSlotType: RESULT getResult: ALLOW isCancelled: false getWhoClicked: N0t_Kai getViewers: [CraftPlayer{name=N0t_Kai}]

Basically, this indicates a click with an empty cursor on a result slot containing a furnace. The materials are all prefixed LEGACY_ because EventDebug doesn't declare an api-version.

In the case of the GE code, the first line I linked should cause it to stop executing and not do anything to handle normally non-enchantable objects, which is what puzzles me.

If you would, please try this dev build - the result item will be set again after event completion when the cost data is sent. It's not ideal since I'm basically bypassing the event results, but hopefully it'll work as a temporary solution.

Polar0634 commented 3 years ago

Ah ok, that makes more sense; and from what I can tell, the Dev build seems to be working. The only thing I've noticed is a slight visual bug should you try and click in the anvil, rather than shift-click it straight into your inventory however it still does what it needs to do. Either way though, the build works a charm so thanks again!

Jikoo commented 3 years ago

Glad to hear it's working. Re: visual bugs, not a lot I can do on that front without version-specific code or excessive inventory updating, which can actually make things worse for clients with high latency/crappy internet. I'll consider this semi-resolved, but I do want to see if I can find a better way to handle it before I push a release.