Xhamolk / XACT

Xhamolk's Advanced Crafting Table. Inspired by Eloraam mod's RP2 and it's Project Table.
http://www.minecraftforum.net/topic/1551715-xact-xhamolk-s-advanced-crafting-table/
11 stars 5 forks source link

ItemContainer guaranty enforcing #49

Closed Xhamolk closed 11 years ago

Xhamolk commented 11 years ago

The Basic Functionality for ItemContainer and ContainerItem (637af3ba761ee09686dc9f704c3f3330ef2a7774) has the following flaw(s):

  1. It does not guarantee that the _item in use_ is the same item that opened the GUI, so this could lead to exploits for cheating items.

These flaws need to be fixed before I can make a PR against Forge for adding support for this.

Xhamolk commented 11 years ago

Possible solutions for [1]:

Xhamolk commented 11 years ago

Solution: Overrode the Container.slotClick() method, so it checks ContainerItem.slotContainsHeldItem(). If that returns true, then prevent the pick up, and call ContainerItem.onPickupPrevented().

I believe this is a bit more safe (gameplay-wise) than throwing the item to the world when it's picked from the GUI, which was the idea I had after observing RP2's Canvas Bags do that.