The Bug:
Traveling by boat or raft doesn't cause food exhaustion.
I believe this is a problem because you can travel thousands of blocks by boat without your hunger depleting and this seems rather illogical.
Steps to Reproduce:
Locate a large body of water and summon a boat on it.
Enter the boat and check what the value of your "foodExhaustionLevel" NBT data by using the command provided below.
/data get entity @s foodExhaustionLevel
Take note of this value and begin paddling around in the boat for around twenty seconds.
Check the value of your "foodExhaustionLevel" NBT data once again by using the command provided below.
/data get entity @s foodExhaustionLevel
Take note as to whether or not your "foodExhaustionLevel" value is the same as when you first entered the boat. (If this value didn't change, no hunger was consumed when paddling in the boat).
Observed Behavior:
Hunger isn't consumed.
Expected Behavior:
Traveling by boat or raft would cause food exhaustion.
Code Analysis:
Code analysis by @unknown can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.entity.player.Player.java
public abstract class Player extends LivingEntity {
...
private void checkRidingStatistics(double $d0, double $d1, double $d2) {
if (this.isPassenger()) {
int i = Math.round((float)Math.sqrt($d0 * $d0 + $d1 * $d1 + $d2 * $d2) * 100.0F);
if (i > 0) {
Entity entity = this.getVehicle();
if (entity instanceof AbstractMinecart) {
this.awardStat(Stats.MINECART_ONE_CM, i);
} else if (entity instanceof Boat) {
this.awardStat(Stats.BOAT_ONE_CM, i);
} ...
If we look at the above class, we can see that food exhaustion isn't applied to the player when they travel by boat. The causeFoodExhaustion()
method (the method responsible for applying food exhaustion to the player), isn't present anywhere within this piece of code, resulting in this problem occurring.
Potential Fix:
Simply calling the causeFoodExhaustion()
method within this piece of code where appropriate, should resolve this problem. The following line of code could be used in order to fix this:
this.causeFoodExhaustion(XF * (float)i * XF)
Linked issues
is duplicated by 1
Comments 15
Not a good comparison. Horses and minecarts are not propelled by the player. Hard to believe is intended, as boats are ridiculously fast for costing only 5 planks.
Please go to the minecraftsuggestions subreddit for feature suggestions.
Can confirm that this issue is still present in 1.18.1. Below, I've provided some additional information regarding this problem.
The Bug:
Riding boats doesn't cause food exhaustion.
Steps to Reproduce:
Locate a large body of water and summon a boat on it.
Enter the boat and check what your "foodExhaustionLevel" is by running the following command.
/data get entity @s foodExhaustionLevel
Take note of this value and begin paddling around in the boat for around twenty seconds.
Check your "foodExhaustionLevel" once again by running the following command.
/data get entity @s foodExhaustionLevel
Take note as to whether or not your "foodExhaustionLevel" value is the same as when you first entered the boat. (If this value didn't change, no hunger was consumed when paddling in the boat).
Observed Behavior:
Hunger isn't consumed.
Expected Behavior:
Riding boats would cause food exhaustion.
Here's a code analysis along with a potential fix regarding this issue. The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn. Please note that I'm quite tentative about this analysis, although I'm persuaded to believe that this is likely the cause of the problem. 🙂
Code Analysis (tentative):
net.minecraft.world.entity.player.Player.java
public abstract class Player extends LivingEntity {
...
private void checkRidingStatistics(double p_36388_, double p_36389_, double p_36390_) {
if (this.isPassenger()) {
int i = Math.round((float)Math.sqrt(p_36388_ * p_36388_ + p_36389_ * p_36389_ + p_36390_ * p_36390_) * 100.0F);
if (i > 0) {
Entity entity = this.getVehicle();
if (entity instanceof AbstractMinecart) {
this.awardStat(Stats.MINECART_ONE_CM, i);
} else if (entity instanceof Boat) {
this.awardStat(Stats.BOAT_ONE_CM, i);
} ...
If we look at the above class, we can see that when riding a boat, food exhaustion is not considered as the this.causeFoodExhaustion()
method isn't present anywhere within this piece of code.
Potential Fix (tentative):
Simply adding the this.causeFoodExhaustion()
method within this piece of code where appropriate would potentially resolve this problem.
net.minecraft.world.entity.player.Player.java
public abstract class Player extends LivingEntity {
...
private void checkRidingStatistics(double p_36388_, double p_36389_, double p_36390_) {
if (this.isPassenger()) {
int i = Math.round((float)Math.sqrt(p_36388_ * p_36388_ + p_36389_ * p_36389_ + p_36390_ * p_36390_) * 100.0F);
if (i > 0) {
Entity entity = this.getVehicle();
if (entity instanceof AbstractMinecart) {
this.awardStat(Stats.MINECART_ONE_CM, i);
} else if (entity instanceof Boat) {
this.awardStat(Stats.BOAT_ONE_CM, i);
this.causeFoodExhaustion(XF * (float)i * XF);
} ...
this is probably intended. Horses and minecarts don't affect hunger either.