mojira.dev
MC-123376

Zombified piglin spawning in a nether portal in the overworld affected by random tick speed

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

  1. Build a nether portal

  2. Set the random tick speed to a higher value (e. g. use /gamerule randomTickSpeed 10000)

  3. Wait a bit and observe the portal

Linked issues

Attachments

Comments 16

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.

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 think that this comand just speeds up the time in minecraft

Confirmed for 1.13.1.

6 more comments

Can confirm in 1.17.1 Release Candidate 1.

Can confirm in 21w40a.

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.

Can confirm in 1.18.2.

Nasko 222

(Unassigned)

Confirmed

Mob spawning

/gamerule, randomTickSpeed

Minecraft 1.12.2, Minecraft 17w50a, Minecraft 1.13, Minecraft 18w31a, Minecraft 18w32a, ..., 21w40a, 1.18.1, 1.18.2, 22w12a, 1.21.2 Pre-Release 5

Retrieved