Better Eating Mod

Better Eating Mod

22.7k Downloads

Certain items are not prevented from being used

qtquwu opened this issue ยท 3 comments

commented

From testing so far, here is a list of items that can and cannot be used when the cooldown timer is active:

Cannot:
ender pearl
eye of ender
fishing rod
bucket (of water/lava/fish AND empty)
boat
book & quill
snowball
armor
Bottle o' Enchanting
Empty Bottle
Splash or Lingering Potion
Saddle or Horse Armor (but it results in odd behavior where the horse's inventory is accessed instead, rather than the item's use (equipping) or the empty-handed interaction (riding))
Egg
Empty Map
Spyglass

Can:
firework
axe (i.e. stripping wood)
hoe
bonemeal
flint and steel
shears
fire charge
minecart
spawn egg
Shield (ideally let's not change this actually)
Item Frame
Armor Stand
Dye (i.e. dying a sheep - tested with light blue dye but I assume it's the same for all)
Name tag
Coal (i.e. fueling a furnace minecart)

Some possible explanations:
-some of these are marked as entity interactions, and are thus handled by "interactEntity." This is almost surely the case for shears, for instance.
-some of these might be considered "block interactions" that are NOT cancelled by sneaking. Currently, block interactions are only cancelled if they would be cancelled by sneaking. This works well for interactions such as opening a crafting table or chest, but may not work for things such as placing a minecart, using bone meal on a block, or using flint and steel. This would explain quite a lot, but possibly not everything (why does it still prevent using an empty bucket? Wouldn't that be a block interaction?)

commented

There is, in fact, a useOnBlock method within the ItemStack class that is NOT currently affected by the eating cooldown timer in any way. Fixing this (and ideally changing the shouldCancelInteraction code) will hopefully fix the issue

commented

Cancelling block interactions by intercepting the PlayerEntity's "shouldCancelInteraction" code is actually super busted. This code is also used for other things, such as minecarts (you don't enter a minecart while crouching) and, noticeably, horses: you open a tamed horse's inventory when right-clicking while sneaking. Perhaps it may be more appropriate to replace the specific call to "shouldCancelInteraction" within the interactBlock method of ClientPlayerInteractionManager.java

commented

Fixed by #16