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.
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.
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
is duplicated by 18
relates to 2
Attachments
Comments 35
screenshot '2013-03-24_22.32.08'
Is me spawning a wolf
screenshot '2013-03-24_22.32.14'
Is the wolf dien
Also duplicated by MC-103936.
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
This is still happening in the 1.5 prerelease. Please fix.