Solved Supply crate (like in survivalgames) how???

Discussion in 'Plugin Development' started by micrlink, Apr 27, 2013.

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

    micrlink

    How does the survivalgames plugins manipulate the piston texture to chests??
     
  2. Offline

    Ugleh

    I don't know what mini game your talking about but if you are saying a piston acts like a chest then its just a player inventory event when right clicking the piston.
     
  3. Offline

    georgeamare

    They use a custom inventory i think ..
     
  4. Offline

    micrlink

    But how is it done to make it look like. And have the gui
     
  5. I know that you can spawn the falling "crates" by using .spawnFallingBlock(location, Material.PISTON_MOVING_PIECE , (byte)1 );

    Or it was using Material.PISTON_EXTENSION can't really remember, try it out yourself. Now I do not now how to prevent those falling blocks from breaking when they hit the ground.
     
    John00708 likes this.
  6. Offline

    Rprrr

    TfT_02
    They don't break. It's more trouble preventing them forming blocks than actually stopping them from doing that.
     
  7. Oh, I remember that they were breaking all the time for me. But either way, they're a bit hacky and odd to work with.
     
    devilquak likes this.
  8. Offline

    micrlink

    Is their a way to do set material.piston_moving_piece

    bump

    Bump

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

    micrlink

  10. Offline

    Minnymin3

    If i were you i would just spawn a falling sand block with the id of a chest and then when it turns back into a chest fill it. I think there is an event for sandEntity turning back into a block...
     
    devilquak likes this.
  11. Offline

    micrlink

    But my question now is how to I know when the block hits the ground and is it possible to place a block with a piston look like the falling block looks like.
     
  12. Offline

    Minnymin3

    EntityChangeBlockEvent. and what do you mean with regards to the piston?
    Heres how to spawn the block:
    Code:
    FallingBlock test = world.spawnFallingBlock(someLocation, Material.CHEST, (byte) 0);
    
    Then check if the EntityChangeBlockEvent is a chest and then add the items.
     
  13. Offline

    micrlink

    How to place Material.PISTON_MOVING_EXTENSION
     
  14. Offline

    BajanAmerican

    micrlink Trying to copy the Jolly Ol' Brits from the Hive I see ;)
     
  15. Offline

    micrlink

    no they are not the only one who use it
     
  16. Offline

    BajanAmerican

    Just saying :)
     
  17. Offline

    chasechocolate

    micrlink block.setType(Material.PISTON_MOVING_EXTENSION). And then listen for PlayerInteractEvent and check if they click on a block with the type of the piston extension, and then open your custom inventory.
     
  18. Offline

    zeddio

    The gui:
    PHP:
    int rows 3;
    Inventory inv = new CraftInventoryCustom(playerrows 9"Supply Crate");
    'player' can just be a random player, but remeber that all player that are supposed to view that inventory, use:
    PHP:
    player.openInventory(inv);
    Also, the crates used in HiveMC are sided piston with id PISTON (33) and data (byte) 6.
    PHP:
    public void onPlayerInteract(PlayerInteractEvent event){
            
    Player player event.getPlayer();
         
            if(
    event.getAction() == Action.RIGHT_CLICK_BLOCK){
             
                
    Inventory inv = new CraftInventoryCustom(player9"Supply Crate");
             
                
    //How you want to add and check whats left after he closed it is up to you
             
                
    player.openInventory(inv);
             
            }
        }
    Hope that helped :)
     
  19. Offline

    micrlink

    It helps alot but how would i place the 33 (byte) 6. I tried setTypeId(33, (byte) 6); and set TypeIdandData(33, (byte) 6, true);

    Thank you all I have finally Solved how to do this!

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

    hayhaycrusher

    how did you stop the block from breaking when it hit the flood, how did you make it place piston moving piece
     
  21. Offline

    micrlink

    make a Timer for the amount of time it is in the air and then set TypeId 33 set data 6
     
  22. Offline

    BarfBoy1

    May I ask how you Handled the inventory?
    Also for anyone who didn't know, I used:
    Code:Java
    1. FallingBlock test = world.spawnFallingBlock(someLocation, 33, (byte) 7);

    To make the crate.
     
  23. Offline

    seanhi2

    Now to edit survival games plugin to fill up the piston (33:6) with random items
    Also the hive have them spawning in random places
     
  24. Offline

    micrlink

    On player interact, you also store the inventory in a hashmap with location
     
  25. Offline

    BarfBoy1

    May I see a example?
     
  26. Offline

    starboy103

    Can you please post the Survival Games plugin you have with the supply crates and everything?
    Thanks
     
  27. Offline

    micrlink

    I do not have a survivalGames plugin I went back to using the Original but I am making my own listeners, I implemented the Supply Crate into a command tho...
     
  28. Offline

    FlipperFLies

    can i have the plugin? i wanna use it
     
  29. Offline

    Garris0n

Thread Status:
Not open for further replies.

Share This Page