The bug
The spawn rate of zombified piglins in active nether portals increases when the random tick speed of the current world is set to a higher value.
How to reproduce
Set the random tick speed to a higher value (e. g. use
/gamerule randomTickSpeed 10000
)Wait a bit and observe the portal
Linked issues
is duplicated by 4
Attachments
Comments 16
WAI, they won't fix this because that spawning works on random ticks and it would be to complicated and unnecessary to change it for this case.
I can confirm this in 1.18.1. Since this has been specifically coded into the NetherPortalBlock.java
class, this leads me to believe that this is possibly intended.
Regardless, here's a code analysis of this issue. The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
Code Analysis:
net.minecraft.world.level.block.NetherPortalBlock.java
public class NetherPortalBlock extends Block {
...
public void randomTick(BlockState p_54937_, ServerLevel p_54938_, BlockPos p_54939_, Random p_54940_) {
if (p_54938_.dimensionType().natural() && p_54938_.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && p_54940_.nextInt(2000) < p_54938_.getDifficulty().getId()) {
...
if (p_54938_.getBlockState(p_54939_).isValidSpawn(p_54938_, p_54939_, EntityType.ZOMBIFIED_PIGLIN)) {
Entity entity = EntityType.ZOMBIFIED_PIGLIN.spawn(p_54938_, (CompoundTag)null, (Component)null, (Player)null, p_54939_.above(), MobSpawnType.STRUCTURE, false, false);
...
If we look at the above class, we can see that zombified piglin spawning is affected by the randomTickSpeed gamerule.
I am not sure if someone said somewhere that this should not be the case. Normal mob spawning can likely currently not do this task without a major rewrite. Therefore currently the portal blocks summon the zombie pigmen when they are ticked.