You can destroy turtle eggs by standing or jumping on them in spawn protection
The Bug:
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're inside of spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby by using the commands provided below.
/setworldspawn ~ ~ ~
/setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]
- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
public class TurtleEggBlock extends Block { ... private boolean canDestroyEgg(Level $l, Entity $e) { if (!($e instanceof Turtle) && !($e instanceof Bat)) { if (!($e instanceof LivingEntity)) { return false; } else { return $e instanceof Player || $l.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } } else { return false; } } ...
If we look at the above class, we can see that no checks are carried out to see whether or not the turtle egg block is within spawn protection, before allowing it to be trampled. The mayInteract() method (a method used for determining whether a block is inside of spawn protection and is within the world border) is never called within this piece of code, thus resulting in the problem of being able to trample turtle eggs in spawn protection.
Potential Fix:
Simply adding some lines of code that check if the turtle egg block is within spawn protection before allowing it to be trampled, should resolve this problem. This can be achieved by calling the mayInteract() method and adding it appropriately somewhere within the existing "if" statement. The following line of code could be used in order to fix this:
$ENTITY.mayInteract($LEVEL, $BLOCKPOS)
Created Issue:
You are able to break turtle eggs by standing on them in spawn protection
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
→Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
→Notice how the turtle eggs break.
Information:
The turtle eggs should not be broken as they are in spawn protection.
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
→Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
→Notice how the turtle eggs break.
Information:
The turtle eggs should not be broken as they are in spawn protection.
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- →
Notice how the turtle eggs break.
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- →
Notice how the turtle eggs break.
Expected Behavior:
The expected behavior would be that you are not able to break turtle eggs by standing on them in spawn protection.
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- →
Notice how the turtle eggs break.
Expected Behavior:
The expected behavior would be that you arenotable to break turtle eggs by standing on them in spawn protection.The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- →
Notice how the turtle eggs break.
Observed Behavior:
You are able to break turtle eggs by standing on them in spawn protection.
Expected Behavior:
You would not be able to break turtle eggs by standing on them in spawn protection.
The Bug:
You are able to break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- →
Notice how the turtle eggs break.
Observed Behavior:
You are able to break turtle eggs by standing on them in spawn protection.
Expected Behavior:
You would not be able to break turtle eggs by standing on them in spawn protection.
The Bug:
You
are able tobreak turtle eggs by standing on them in spawn protection.Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
Observed Behavior:
You
are able tobreak turtle eggs by standing on them in spawn protection.Expected Behavior:
You would not be able to break turtle eggs by standing on them in spawn protection.
The Bug:
You can break turtle eggs by standing on them in spawn protection.
Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
- Give operator permissions to any person other than yourself.
- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt the break the turtle egg(s) by standing on them.
- Take note as to whether or not you can break turtle eggs by standing on them in spawn protection.
Observed Behavior:
You can break turtle eggs by standing on them in spawn protection.
Expected Behavior:
You would not be able to break turtle eggs by standing on them in spawn protection.
Youare able tobreak turtle eggs by standing on them in spawn protectionYou can break turtle eggs by standing on them in spawn protection
The Bug:
You can
breakturtle eggs by standing on them in spawn protection.Steps to Reproduce:
- Start a server and join it.
- Give operator permissions to yourself.
- Set the world spawn to your current location.
- Place some turtle eggs on the floor.
- Remove your operator permissions.
Give operator permissions to any person other than yourself.- Attempt to break the turtle egg(s) by mining them.
- →
Notice how you are unable to do so.
- Attempt t
he breakthe turtle egg(s)by standing on them.- Take note as to whether or not you can
breakturtle eggs by standing on them in spawn protection.Observed Behavior:
You can break turtle eggs by standing on them in spawn protection.Expected Behavior:
You would not be able to break turtle eggs by standing on them in spawn protection.The Bug:
You can destroy turtle eggs by standing or jumping on them in spawn protection.
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're in spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby.
/setworldspawn ~ ~ ~ /setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]
- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
You canbreakturtle eggs by standing on them in spawn protectionYou can destroy turtle eggs by standing or jumping on them in spawn protection
The Bug:
You can destroy turtle eggs by standing or jumping on them in spawn protection.
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're in spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby.
/setworldspawn ~ ~ ~ /setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]
- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
The Bug:
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're inside of spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby.
/setworldspawn ~ ~ ~ /setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]
- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.level.block.TurtleEggBlock.javapublic class TurtleEggBlock extends Block { ... private boolean canDestroyEgg(Level $l, Entity $e) { if (!($e instanceof Turtle) && !($e instanceof Bat)) { if (!($e instanceof LivingEntity)) { return false; } else { return $e instanceof Player || $l.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } } else { return false; } } ...If we look at the above class, we can see that no checks are carried out to see whether or not the turtle egg block is within spawn protection, before allowing it to be trampled. The mayInteract() method (a method used for determining whether a block is inside of spawn protection and is within the world border) is never called within this piece of code, thus resulting in the problem of being able to trample turtle eggs in spawn protection.
Potential Fix:
Simply adding some lines of code that check if the turtle egg block is within spawn protection before allowing it to be trampled, should resolve this problem. This can be achieved by calling the mayInteract() method and adding it appropriately somewhere within the existing "if" statement. The following line of code could be used in order to fix this:
$ENTITY.mayInteract($LEVEL, $BLOCKPOS)
The Bug:
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're inside of spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby.
/setworldspawn ~ ~ ~ /setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]
- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.level.block.TurtleEggBlock.javapublic class TurtleEggBlock extends Block { ... private boolean canDestroyEgg(Level $l, Entity $e) { if (!($e instanceof Turtle) && !($e instanceof Bat)) { if (!($e instanceof LivingEntity)) { return false; } else { return $e instanceof Player || $l.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } } else { return false; } } ...If we look at the above class, we can see that no checks are carried out to see whether or not the turtle egg block is within spawn protection, before allowing it to be trampled. The mayInteract() method (a method used for determining whether a block is inside of spawn protection and is within the world border) is never called within this piece of code, thus resulting in the problem of being able to trample turtle eggs in spawn protection.
Potential Fix:
Simply adding some lines of code that check if the turtle egg block is within spawn protection before allowing it to be trampled, should resolve this problem. This can be achieved by calling the mayInteract() method and adding it appropriately somewhere within the existing "if" statement. The following line of code could be used in order to fix this:
$ENTITY.mayInteract($LEVEL, $BLOCKPOS)The Bug:
Players without operator permissions cannot normally interact with or destroy blocks inside spawn protection, however, you are able to destroy turtle eggs by standing or jumping on them, regardless of whether or not they're inside of spawn protection.
Steps to Reproduce:
- Start a server, join it, give operator permissions to yourself, and switch into creative mode.
- Set the world spawn to your current location and summon some turtle eggs nearby by using the commands provided below.
/setworldspawn ~ ~ ~/setblock ~ ~ ~-2 minecraft:turtle_egg[eggs=4]- Switch into survival mode, remove your operator permissions, and grant anyone else with them in order to activate spawn protection.
- Attempt to destroy the turtle eggs by standing or jumping on them.
- Take note as to whether or not you can destroy turtle eggs by standing or jumping on them in spawn protection.
Observed Behavior:
Turtle eggs are destroyed.
Expected Behavior:
Turtle eggs would not be destroyed.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.level.block.TurtleEggBlock.javapublic class TurtleEggBlock extends Block { ... private boolean canDestroyEgg(Level $l, Entity $e) { if (!($e instanceof Turtle) && !($e instanceof Bat)) { if (!($e instanceof LivingEntity)) { return false; } else { return $e instanceof Player || $l.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } } else { return false; } } ...If we look at the above class, we can see that no checks are carried out to see whether or not the turtle egg block is within spawn protection, before allowing it to be trampled. The mayInteract() method (a method used for determining whether a block is inside of spawn protection and is within the world border) is never called within this piece of code, thus resulting in the problem of being able to trample turtle eggs in spawn protection.
Potential Fix:
Simply adding some lines of code that check if the turtle egg block is within spawn protection before allowing it to be trampled, should resolve this problem. This can be achieved by calling the mayInteract() method and adding it appropriately somewhere within the existing "if" statement. The following line of code could be used in order to fix this:
$ENTITY.mayInteract($LEVEL, $BLOCKPOS)


Relates to MC-222492.
I was able to reproduce in 1.16.5 and 21w15a