XP From Harvest

XP From Harvest

16M Downloads

Simple Harvest ignores Fortune enchantment

Dekamir opened this issue ยท 12 comments

commented

Drops should increase when the held item has the Fortune enchantment (tool type doesn't matter).
Instead, regular drop tables apply.

Doesn't affect regular (left-click) breaking.

commented

What version of MC?

commented

So it works with block breaking and does not with simple harvest?

commented

Exactly.

commented

1.18.1. Latest available mod for Forge.

commented

I see, with block break I use block.dropXpOnBlockBreak in 12.2 or block.popExperience in later versions which I guess is triggered after block is broken and takes enchantments into account by MC itself. For simple harvest I simply use EntityXPOrb in 12.2, ExperienceOrbEntity in 16.5 or player.giveExperiencePoints in 1.18. Is there any way to spawn XP orb by MC that will work exactly like popExperience?

commented

I used to use a hacky way to do it.
Check if the player is holding a tool with Fortune (and is in Survival/Adventure - or not Creative) > Spawn more ores when block is broken.

I'm not proud of it, I just couldn't find a better way to do so.

commented

Well if Forge does not provide better way to do it then your solution is the one to go. I'll take a look when I have some time.

commented

By the way do you know any good source of Forge API documentation? With good description of classes and methods? This one seems shallow to me https://mcforge.readthedocs.io/en/1.18.x/

commented

I mostly use that one, too. Forge is cryptic, and there is not many documentors outside of themselves.
Maybe I'll find some other people complaining and find other ways.

BTW, I'm talking about the item drops, not XP. I just realised I may have forgot to mention that. Just to check.

commented

No (according to Wiki).
In fact, there is no mechanic in Vanilla to increase XP gains.

commented

BTW, I'm talking about the item drops, not XP. I just realised I may have forgot to mention that. Just to check.

Good point BTW. Please remind me do players get more XP from mining with fortune enchanted pickaxe?

commented

OK, then it will only affect drops.