[MC-109805] Farmland can be placed on invalid locations Created: 07/Nov/16  Updated: 28/Jul/18  Resolved: 30/Nov/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 16w44a, Minecraft 1.11 Pre-Release 1
Fix Version/s: Minecraft 16w50a

Type: Bug
Reporter: No User Assignee: [Mojang] Maria Lemón
Resolution: Fixed Votes: 2
Labels: None

Issue Links:
Relates
relates to MC-102986 Can place Grass Path at "invalid" loc... Resolved
CHK:
Confirmation Status: Confirmed

 Description   

Same as MC-102986, but with farmland blocks.


You can pick block farmland and place it under blocks, when you then update the block (by placing a block next to it for example) the farmland will become dirt (intended).

Expected:
The farmland would instantly be replaced by dirt, not after a block update.

Steps to reproduce:

In creative pick block farmland.
Place a block (for example planks)
Place the farmland below it.
See it doesn't change to dirt.
Place a block besides the farmland.
See it change to dirt.


Fix: (Based off of Minecraft 1.11, MCP 9.35)

net.minecraft.block.BlockFarmland.java
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        super.onBlockAdded(worldIn, pos, state);
        this.func_190971_b(worldIn, pos);
    }

    private void func_190971_b(World worldIn, BlockPos pos)
    {
        if (worldIn.getBlockState(pos.up()).getMaterial().isSolid())
        {
        	worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
        }
    }

Generated at Mon Oct 15 16:03:23 CDT 2018 using Jira 7.11.2#711002-sha1:fdc329dee91471a641faabfe39b5ff8c0a5b3f66.