Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-8293

Dispensers spawn mobs without offset along the y-axis

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 16w32a
    • Snapshot 13w04a, Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w18c, Snapshot 13w19a, Snapshot 13w24a, Snapshot 13w24b, Snapshot 13w25a, Snapshot 13w25b, Snapshot 13w25c, Minecraft 1.6, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.7.4, Minecraft 14w03b, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 1.8, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w31a, Minecraft 15w36d, Minecraft 15w38a, Minecraft 15w38b, Minecraft 15w39b, Minecraft 15w39c, Minecraft 15w43b, Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w47b, Minecraft 15w47c, Minecraft 1.8.9, Minecraft 15w51b, Minecraft 16w02a, Minecraft 16w06a, Minecraft 16w07a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9 Pre-Release 2, Minecraft 1.9 Pre-Release 3, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 16w14a, Minecraft 16w15a, Minecraft 16w15b, Minecraft 1.9.3 Pre-Release 1, Minecraft 1.9.3 Pre-Release 2, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.9.3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2
    • None
    • Confirmed

      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. 2015-09-19_01.12.23.png
      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. 2015-09-19_01.12.33.png

      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"

        1. 2013-03-24_22.32.08.png
          2013-03-24_22.32.08.png
          474 kB
        2. 2013-03-24_22.32.14.png
          2013-03-24_22.32.14.png
          384 kB
        3. 2015-09-19_01.12.23.png
          2015-09-19_01.12.23.png
          30 kB
        4. 2015-09-19_01.12.33.png
          2015-09-19_01.12.33.png
          36 kB

            jeb [Mojang] Jeb (Jens Bergensten)
            panda4994 [Mojang] Panda
            Votes:
            72 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: