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

When using spawn eggs on fences the mobs fall through

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.8.8, Minecraft 15w36b, Minecraft 15w36c, Minecraft 15w36d, Minecraft 15w37a, Minecraft 15w38a, Minecraft 15w38b, Minecraft 15w39b, Minecraft 15w39c, Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w47b, Minecraft 15w47c, Minecraft 1.8.9, Minecraft 15w51b, Minecraft 16w05b, 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
    • Fix Version/s: Minecraft 16w32a
    • Labels:
      None
    • Confirmation Status:
      Community Consensus

      Description

      I recently saw that there is a part of code intended to make spawn eggs work on fences so that the mob stands on top of the fence.
      It looks like that:

      ItemSpawnEgg.java (ItemMonsterPlacer.java in MCP)
      	...
      	public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
      		...
      		IBlockState var9 = worldIn.getBlockState(pos);
      		...
      		// It's supposed to check if the block it was placed one is a fence. How ever it's checking the BlockState, not the block.
      		// What was meant to be done is var9.getBlock() instead of just var9.
      		if(side == EnumFacing.UP && var9 instanceof BlockFence) {
      			// Offset for the spawn
      			var13 = 0.5D;
      		}
      		...
      	}
      	...
      

      Better fix

      As seen in the code snippet there is just a .getBlock() missing.

      However when fixing this you could also make the offset (here var13) depended on the collision box of the block.
      Then it would work for fence gates, cobble walls and also for slabs and so on too.

      Video: https://youtu.be/ZkI3uU7hoBA?t=1m09s

      This post might be seen as related: MC-65951

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                FruBasilicum [Mojang] Agnes Larsson
                Reporter:
                panda4994 Panda
              • Votes:
                35 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: