1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Bukkit Bug BlockStateMeta retains position, which makes items not stack

Discussion in 'Bugs & Feature Requests' started by TrashCaster, Jun 7, 2015.

  1. As the title reads, when you update a BlockStateMeta using a BlockState, it will include the position of the Tile Entity, which will make items of the same type not stack, unless they have the same position.

    I consider it a bug, but if it's "working as intended", then I guess it's a feature change request.

    Why does this matter?

    I've made a plugin that lets you Silk Touch mob spawners, and I'm using BlockStateMeta to save the BlockEntityTag on the item. The position being saved (or just being unique, instead of zeroing it out) makes them not stack even though the mob is the same type.

    I'm using an unsafe work around (which is actually the fix, just done via the plugin with "version unsafe" class access.

    This is my work around.
    Code (Text):

                CraftCreatureSpawner spawner = (CraftCreatureSpawner)event.getBlock().getState();
                TileEntityMobSpawner te = spawner.getTileEntity();
    The fix is the te.a(BlockPosition.ZERO);

    Just add that to the end of setBlockState, and it's golden.