Solved How to make/get supply crates as seen on hivemc.eu??

Discussion in 'Plugin Development' started by NicksTheBoss, Aug 17, 2013.

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

    NicksTheBoss

    How do I get/code the supply crates as seen on hive survival games?
    Does anybody know code to make pistons or a block open up a custom inventory or gui like supply crates? If you do or have any suggestions please feel free to help.
     
  2. Offline

    PHILLIPS_71

    I'm not sure if this is what you are after but here is how to open a chest on a players right click of a block.

    Code:
    private Inventory Storage;
    if(e.getClickedBlock().getType() == Material.IRON_BLOCK && e.getAction() == Action.RIGHT_CLICK_BLOCK ) {
                Storage = Bukkit.getServer().createInventory(null, 27,  ChatColor.GREEN + "storage");
                e.getPlayer().openInventory(Storage);
     
  3. Offline

    NicksTheBoss

    Its close to what I'm am trying to do! That is really good information on how to open the crates but the problem is how do I make them??
     
  4. Offline

    JPG2000

    NicksTheBoss Like what do you mean make? Like the 4 sided ones?
     
  5. Offline

    NicksTheBoss

    When I say make I mean how do I create them in a eclipse. I need code on how to make the Supply crates as seen on hive. And if you do not know how they look the are the piston boxes.
     
  6. Offline

    Axe2760

    I believe the item ID is 36:6, you can work from there :)
     
    ilethz likes this.
  7. Offline

    NicksTheBoss

    But do you know how to create the crate?
     
  8. Offline

    fireblast709

    Code:
    public void placeBox(Location loc)
    {
        loc.getBlock().setTypeIdAndData(36, (byte)6, false);
    }
     
  9. Offline

    AstramG

    I think he's asking for a method to determine the locations of the crates.
     
  10. Offline

    NicksTheBoss

    What is that for!?
     
  11. Offline

    ZeusAllMighty11

    NicksTheBoss

    That creates a block with id 36, damage value 6, and some boolean like you asked?
     
  12. Offline

    NicksTheBoss

    Okay? But if I do use that how would I spawn the block in so I can place it?
     
  13. Offline

    etaxi341

  14. Offline

    NicksTheBoss

    Set what arena??
     
  15. Offline

    etaxi341

    NicksTheBoss I think you are using the crates in an Arena. Or not? But you need to set the locations of the crates. Maybe with an Command.
     
  16. Offline

    Axe2760

    You cannot "place" a 6 sided piston block. However, what you can do is place chests in your map, and items in them. Then before the game you can iterate through the map, and change each chest to 36:6, and get the items in the chest. Then you could maybe store them as metadata? When you open the piston crate, you would then get that metadata and place it in the inventory. Hypothetically that would work.
     
  17. Offline

    NicksTheBoss

    Okay. Is there anyway easier way?

    You got a example?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  18. Offline

    xTrollxDudex

  19. Offline

    NicksTheBoss

  20. Offline

    xTrollxDudex

    NicksTheBoss
    What specifically are you having a problem with?
     
  21. Offline

    NicksTheBoss

    I'm having a problem with creating the crates and actually being able to place them.
     
  22. Offline

    xTrollxDudex

    NicksTheBoss
    You can't place them -_-

    The Hive has Mapmakers place sponges where the normal chests are and when it is accepted, they will remove all the sponges and set them to crates. Ender chests represent Tier 2 chests (At cornucopia and special places)

    The crates fall with world.spawnFallingBlock() and use block.setTypeIdAndData(33, (byte) 6, true);
     
  23. Offline

    Axe2760

    NicksTheBoss I tried a billion ways to place them before, you have to use the method above to set the type/damage value. That being said, you could always listen for a block place event, and use some unused or not very used block like a sponge. Then set the type on placement. Storing items inside is a different thing, though, maybe text file or config? You can also load them into a HashMap on enable, and save them on disable.

    Edit: Ninja'd :p (kinda)
     
  24. Offline

    xTrollxDudex

  25. Offline

    NicksTheBoss

    I will try that :)
    Hopefully it works.
     
  26. Offline

    NicksTheBoss

    I am probably going to use a block that can be placed in minecraft. Well if you have essentials. But the id for it is 43:8
     
  27. Offline

    NicksTheBoss

    So the 43:8 block
    So I tried the 43:8 one and it worked :) But I still want the piston sided block. So if you know how to use EntityChangeBlockEvent so I can make a useless block turn into the crate , It will help.
     
  28. Offline

    NicksTheBoss

    Found a easy way to do this!!! Changing this page to solved.
     
  29. Offline

    re4ly

  30. Offline

    NicksTheBoss

    Use the code that PHILLIPS_71 used and then with WorldEdit place a block like cobblestone then use the wand and gather the positions, then use the command //replace <block> 33:6
     
Thread Status:
Not open for further replies.

Share This Page