Skip to content

Instantly share code, notes, and snippets.

@maxov
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxov/32bf70235b8b97440129 to your computer and use it in GitHub Desktop.
Save maxov/32bf70235b8b97440129 to your computer and use it in GitHub Desktop.
inventory
Player player;
ItemStack myItemStack = ItemStacks.builder().itemType(ItemType.PLANKS).dataValue(3);
// used by player and crafting table -- has matrix and result
CraftingInventory crafting = player.getInventory().getCraftingInventory();
// the 'input' to the crafting inventory
// it is a grid of items
ItemGrid matrix = crafting.getMatrix();
// _ *
// _ _
matrix.setContents(1, 0, itemStack);
matrix.setContents(new Vector2i(1, 0), itemStack);
// a single item slot
ItemSingle result = crafting.getResult():
// we can also use the old, indexed way way
player.getInventory().setContents(2, itemStack);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment