Adding fire/water/lava to inventory

Discussion in 'Plugin Development' started by blue1, Mar 4, 2016.

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

    blue1

    Hey! I have been developing a nice little plugin called Ultimate Block Command for a good while now, and I wanted to do something very special with it; Crafting fire with blaze powder using /block. But I can't seem to add fire to the player's inventory... I have seen games where you can hold water or lava in your inventory without using a bucket. How can I do this?
    What I have tried:
    Code:
          else if(cmd.getName().equalsIgnoreCase("fire")){
              ItemStack fire = new ItemStack(Material.FIRE, 1);
              p.getInventory().setItemInHand(fire);
          }
    
    and
    Code:
          else if(cmd.getName().equalsIgnoreCase("fire")){
              ItemStack fire = new ItemStack(Material.FIRE, 1);
              p.getInventory().addItem(fire);
          }
     
  2. Offline

    Irantwomiles

    Well if u want it to be craft able you are using the wrong thing but I would try adding it by ID instead
     
  3. Offline

    blue1

    Well I tried this and it didn't work either. I also tried giving myself something, and then setting the ID of that item in my inventory to 51 which did nothing, and tried to Material.FIRE which also did nothing.
    And as far as wanting it craftable goes, I'm not wanting that. I only want for the player to type /block and their blaze powder be replaced by fire. I know how to do that part; I only cannot add the fire block directly to the inventory.
    UBC (the plugin) is on Bukkit, but for some reason is not showing up as me having 2 plugins. :confused: Bukkit doesn't like me atm.
     
    Last edited: Mar 7, 2016
  4. Offline

    blue1

    Does nobody know how to do this? It seems like SOMEBODY should! (This is a bump... after 2 days of waiting. If this gets moderated too, I'm going to be pretty ticked off.) I have tried changing the ID, adding it to the inventory as a Material and also as an ItemStack, I did everything by both ID number and by Material name.
    I'd REALLY like for something to come of this. I know it can be done, as I have seen it. If somebody can figure this out, I just might add instructions to the resources.
     
  5. Offline

    GamerzKing

    You can't directly save lava to your Inventory, as it is a Block, not an ItemStack. Same thing with Material.SKULL. You can't put a Skull in the Inventory, so you have to use Material.SKULL_ITEM. There is no way of directly setting the item in hand to fire, as it can't be added to your Inventory.
     
  6. Offline

    blue1

    So then there is no item for fire? Yet I have seen it in plugins... a command would bring up a gui, and one of the items inside would be fire. A skyblock I used to play on would start your chest with water blocks and a lava block instead of buckets.
    I'll keep trying to figure it out. If anybody can tell me how to do this, I will credit you in the plugin description.
    http://dev.bukkit.org/bukkit-plugins/ultimate-block-command/
     
  7. Offline

    I Al Istannen

    @blue1
    I think they remove the WATER, LAVA and FIRE items in some version. Maybe 1.8? Just guessing, I think I read it somwhere. Do you know any 1.8 plugins that show the fire item? If so, could you write the name or the link?
     
  8. Offline

    blue1

    I don't know what plugin it was, sorry. And that may be, about the items being removed. It was a while ago that I saw it...
     
  9. Offline

    Corndogoz

    yeah,i think it was removed as i have seen those in 1.7, but when ive tried getting it in 1.8, it wouldnt work, i recommend using an item with a custom lore
     
  10. Offline

    blue1

    Well, thanks anyways. :) So sad that they removed it though.
     
Thread Status:
Not open for further replies.

Share This Page