FallenMoonNetwork / CanaryMod

Server administration mod and API for Minecraft beta multiplayer server
http://canarymod.net
GNU Lesser General Public License v3.0
20 stars 14 forks source link

Items not stacking correctly (Dev build 135) Issue due to lore #73

Closed BluXDragon closed 11 years ago

BluXDragon commented 11 years ago

As of one of the newer dev builds, my players are reporting that items are not stacking correctly.

I figured out that the issue happens when using a plugin to read an items lore. This happens to items that do not even have lore.

Item item; //get item
String[] lore = item.getLore();

The code above will cause the item to become "corrupted" in terms of stack-ability.

Old description;

I can explain this best via example.
A player is farming a wheat field - he's running along, picking up the wheat drops, and his stack reaches about 40 in size. He picks up another piece of wheat, and it makes a new stack. He continues without noticing, until he is finished and has four stacks, of seemingly random amounts (40, 17, 13, 25). He tries to combine them, but they refuse to join together.

However, he can drop them and pick them up all at once, upon which they will stack correctly.

This is all I know of the bug. It seems to happen consistently, and with every item type.
14mRh4X0r commented 11 years ago

I've played on another server that has been running build 134, without having this issue. If you can think of steps to repreduce this bug, please post them here.

BluXDragon commented 11 years ago

Running build 135.

I've found the source of the issue, but I can safely say IT SHOULDN'T MAKE SENSE. It's happening with absolutely any of my plugins that check lore. In the example below, the item in your hand becomes unstackable with similar items. This happens with the EXACT code below.

    public void onArmSwing(Player player){
        Item iih = player.getItemStackInHand();
        if (iih == null){return;}
        String[] lore = iih.getLore();
    }