Block to Inventory Item

Discussion in 'Plugin Development' started by wouter0100, Sep 20, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    wouter0100

    Hey,

    I'm trying to save an Block and later add them in an Chest.
    But how can i save and place this on the right way? because when i edit the Block when its saved, like:

    Code:
    replaceChest= chestLocation.getBlock().getData();
    chestLocation.getBlock().setType(Material.CHEST);
     
    Chest chest = (Chest)chestLocation.getBlock().getState();
    chest.getInventory().setItem(chest.getInventory().firstEmpty(), new ItemStack(replaceChest.getTypeId(), 1, (short) replaceChest.getBlock().getData()));
    (With SubID's support)

    But this dont work..

    Thanks!
    Wouter0100

    Nobody? :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  2. Offline

    wouter0100

    Last bump
     
Thread Status:
Not open for further replies.

Share This Page