mojira.dev
MC-8293

Dispensers spawn mobs without offset along the y-axis

Upwards and downwards facing dispensers with spawn eggs will spawn the mob inside the dispenser (instead of on top/below it).
This can cause small mobs (e.g. chicken, silverfish) to suffocate inside the dispenser.

Steps to reproduce
1. Place an upwards facing dispenser on the foor.

[media]

2. Put spawn eggs in it (e.g. Creeper)

3. Trigger the dispenser.
4. The mob is inside the dispenser, and not as expected on top of it.

[media]

Fix
The simplest fix would be to just add the offset to the spawn position of the mob as it is done for x and z already.

Bootstrap.java (in MCP)

public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
            EnumFacing var3 = BlockDispenser.getFacing(source.getBlockMetadata());
            double var4 = source.getX() + (double)var3.getFrontOffsetX();
            // Added  "+ (double)var3.getFrontOffsetY()"
            double var6 = (double)((float)source.getBlockPos().getY() + 0.2F) + (double)var3.getFrontOffsetY();
            double var8 = source.getZ() + (double)var3.getFrontOffsetZ();
            Entity var10 = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), var4, var6, var8);
            if(var10 instanceof EntityLivingBase && stack.hasDisplayName()) {
               ((EntityLiving)var10).setCustomNameTag(stack.getDisplayName());
            }

            stack.splitStack(1);
            return stack;
         }

This fix would be ok already, but for downwards facing dispensers it would still spawn two high+ mobs inside the dispenser with their head.
So the fancy way may be to subtract the height of the mob for downwards facing ones.
Then again this is not done for sideways ones either so I guess just adding the offset would be "as expected" 🙂

Linked issues

MC-8388 Dispenser Bugs Resolved MC-8391 Vertical Dispensers and Mobs Resolved MC-9444 Upward dispensers with mob eggs spawn them in the dispenser block Resolved MC-9797 Upward dispenser mob bug. Resolved MC-10053 Dispenser directed up will suffocate chicken Resolved

Attachments

Comments 35

This is still happening in the 1.5 prerelease. Please fix.

Nicolous smithbobjuniour

yah this isnt resolved, mojang needs to refix this pronto!

screenshot '2013-03-24_22.32.08'
Is me spawning a wolf
screenshot '2013-03-24_22.32.14'
Is the wolf dien

Needs to be fixed 😞... please 🙂

Issues are addressed roughly in order by number of votes. This issue currently ranks #62.

25 more comments

Confirmed for 1.10.

Also duplicated by MC-103936.

Confirmed for 1.10.1.

Jens Bergensten

As mentioned in the description, still doesn't work perfectly for downwards-facing dispensers. Mainly a bit tricky to know how much to offset the entity, since there may be a floor below the dispenser as well

I think the most intuitive, consistent and further bug-preventing would be to put the top of the hitbox at the bottom edge of the dispenser. Should be tested with custom spawn eggs with huge slimes.

Jay Eff

Panda4994

Jens Bergensten

Confirmed

Snapshot 13w04a, Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w10b, ..., Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2

Minecraft 16w32a

Retrieved