mojira.dev
MC-29590

Breaking two-block plants shows wrong breaking particles

Destroying the bottom block of a two-block plant will produce normal particles, but the top's are not calculated correctly. This includes ignoring grass.png data and the flower texture and just producing green particles.

For plants that were placed by the world generation peony particles are created, for plants that you placed sunflower particles are created.

Code analysis: https://bugs.mojang.com/browse/MC-29590?focusedCommentId=285174&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-285174

Related issues

MC-29556 Breaking the top part of a 2 block tall flower will produce only green particles MC-33249 Particle Effect Graphic Error MC-33297 Block breaking particle of the upper part of tall plants (rose bush, lilac, large ferns) is all grass MC-50571 Double grass wrong breaking particles on top-block MC-51263 Breaking Top Half Of Flowers That Are Two Blocks Tall Give Off Incorrect Particles MC-51709 Particle Effect with Double Tallgrass (Color) MC-53397 2-block high plant breaking animation MC-53759 Hitting flowers and facing EAST makes Lilac particles MC-92296 Double Plants display particles error when hit by sword MC-96971 Hitting top part of double plant with a sword in creative mode creates wrong breaking particles MC-101396 Bugs of texture on the particles of flowers and herbs of two blocks of height MC-101597 Wrong particles when hit by sword MC-103087 plant MC-104613 Bug particle double plant

Comments

migrated

Still affects 14w08a.

migrated

Still in 10c

migrated

Still in 14w17a - breaking the lower part of the big plant shows a sunflower blossom for a while

migrated

Unrelated to this issue.

migrated

Confirmed for 14w18a. Still get green particles.

kumasasa

Maybe caused by MC-54131

migrated

Confirmed for 14w19a.

migrated

Fixed in 14w30c

migrated

Unable to reproduce. Does this happen when breaking other double-tall plants and when there isn't a double-tall grass block behind?

kumasasa

Reopened (MC-92296)

migrated

Confirmed for 15w46a.

[Mod]Les3awe

Confirmed for 15w47c
Also affect the Spectator Mode.

marcono1234

Please link to this comment in the description of the report.

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.

The following reason and fix are based on missing (always 8) meta data values for the upper part of a double_plant. There might be other ways of solving this but this is the most logic to me.
This changes requires changes in the methods called by the world generation and when a player places a double plant as well because they ignore currently the flower type for the upper part.

Missing meta data for upper parts

Affected class: net.minecraft.block.BlockDoublePlant
Affected methods:

public IBlockState getStateFromMeta(int meta)

/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    // Replaced this
    //return (meta & 8) > 0 ? this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT_PROP, BlockDoublePlant.EnumPlantType.func_176938_a(meta & 7));
    EnumBlockHalf position;
    if (meta < 8) {
        position = EnumBlockHalf.LOWER;
    }
    else {
        position = EnumBlockHalf.UPPER;
    }
    return this.getDefaultState().withProperty(HALF_PROP, position).withProperty(VARIANT_PROP, BlockDoublePlant.EnumPlantType.func_176938_a(meta & 7));
}

public int getMetaFromState(IBlockState state)

/**
 * Convert the BlockState into the correct metadata value
 */
public int getMetaFromState(IBlockState state)
{
    // Replaced this
    //return state.getValue(HALF_PROP) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 : ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT_PROP)).func_176936_a();
    int meta = ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT_PROP)).func_176936_a();
    if (state.getValue(HALF_PROP) == BlockDoublePlant.EnumBlockHalf.UPPER) meta += 8;
    return meta;
}

Missing flower type for upper parts

This covers the bug that currently for the upper parts no flower type is set because they would lose this information because of the missing meta values anyway

Affected class: net.minecraft.block.BlockDoublePlant
Affected methods:

public void func_176491_a(World worldIn, BlockPos p_176491_2_, BlockDoublePlant.EnumPlantType p_176491_3_, int p_176491_4_)

public void func_176491_a(World worldIn, BlockPos p_176491_2_, BlockDoublePlant.EnumPlantType p_176491_3_, int p_176491_4_)
{
    worldIn.setBlockState(p_176491_2_, this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT_PROP, p_176491_3_), p_176491_4_);
    // Replaced this
    //worldIn.setBlockState(p_176491_2_.offsetUp(), this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.UPPER), p_176491_4_);
    worldIn.setBlockState(p_176491_2_.offsetUp(), this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.UPPER).withProperty(VARIANT_PROP, p_176491_3_), p_176491_4_);
}

public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)

public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    // Replaced this
    //worldIn.setBlockState(pos.offsetUp(), this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.UPPER), 2);
    worldIn.setBlockState(pos.offsetUp(), this.getDefaultState().withProperty(HALF_PROP, BlockDoublePlant.EnumBlockHalf.UPPER).withProperty(VARIANT_PROP, worldIn.getBlockState(pos).getValue(VARIANT_PROP)), 2);
}

Notes:

  • The rendering for double plants needs to be changed as well as the upper part can now determine its type indepently.

  • This change will not affect already placed double plants. Some kind of updating method is needed to give all upper parts the correct meta data based on the block below it.

migrated

Isn't this part of MC-1874 rather then related?

[Mod]Les3awe

Confirmed for 1.9.3-pre3

marcono1234

@unknown, the part

top of double plants (always peony) (breaking, not completly destroying (sword in creative)) (MC-29590)

describes this bug and is probably unrelated to the other situations described in MC-1874

migrated

I added that...

violine1101

Still in 16w21b

violine1101

Still in 1.10-pre1

violine1101

Still in 1.10

migrated

Unable to reproduce in 16w32b.

violine1101

Still in 16w32b, try to destroy the upper part of a two-block plant with a sword in creative mode. Wrong particles.

SunCat

@unknown, it's now included in MC-1874

violine1101

Okay, didn't know that.

marcono1234

Confirmed for

  • 16w33a

I assume the other bugs in MC-1874 are caused by a wrong texture being used. This one however is happening because the data for the upper part is not correctly stored, see this comment as well.

Even if you choose to keep this as a duplicate please change the resolution to "Duplicate".

migrated

(Unassigned)

Confirmed

Minecraft 13w36a, Minecraft 13w39a, Minecraft 13w39b, Minecraft 1.7.4, Minecraft 14w05b, ..., Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10, Minecraft 1.10.2, Minecraft 16w33a

Minecraft 14w30c

Retrieved