[API] FallingBlockAPI - Create custom falling blocks with different functions!

Discussion in 'Resources' started by LCastr0, Aug 6, 2014.

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

    LCastr0

    Hello!
    I've made this API because I was in-need of something like this, and I've found nothing related to this.
    This API can create a FallingBlock , a static FallingBlock (That doesn't move), and a FlyingBlock (I don't think I need to explain this one).
    All of them can be easily edited (Material, data, velocity, location, etc.) after spawned.
    Link to Bukkit Dev coming soon.

    Source:
    You can find the source clicking here.

    Download:
    <Edit by Moderator: Redacted mediafire url>

    How to use:

    plugin.yml:
    Code:java
    1. name: MyCoolPlugin
    2. version: 1.0
    3. main: my.Cool.Plugin.Main
    4. depend: [FallingBlockAPI]


    To create a common FallingBlock, you can use:
    Code:java
    1. Creation creation = FallingBlockAPI.creation();
    2. FallingBlock fallingBlock = creation.createFallingBlock(location, material, data, <boolean: can drop item when break>);
    3.  


    To control this block, you can use:
    Code:java
    1. FallingBlockController fallingBlockController = creation.getFallingBlockControler(fallingBlock); // Using the FallingBlock object I created above
    2. fallingBlockController.setMaterial(Material.STONE); // Will make the FallingBlock material change to Stone


    To create a static FallingBlock, you can use:
    Code:java
    1. StaticFallingBlock staticFallingBlock = creation.createStaticFallingBlock(location, material, data, <boolean: can drop item when break>); // The last boolean does not interfere too much, because this will most likely not break
    2.  


    To control this block:
    Code:java
    1. StaticFallingBlockController staticFallingBlockController = creation.getStaticFallingBlockController(staticFallingBlock);
    2. staticFallingBlockController.setData((byte) 3); // Will change the block's data to 3


    To create a FlyingBlock:
    Code:java
    1. FlyingBlock flyingBlock = creation.createFlyingBlock(location, material, data, <boolea: can drop item when break>);


    To control this block:
    Code:java
    1. FlyingBlockController flyingBlockController = creation.getFlyingBlockController(flyingBlock);
    2. flyingBlockController.setDropItem(true); // This will make the block drop an item when break


    Why is this usefull?
    This is usefull because you won't need to create your own NMS entities to create your FallingBlocks.
    It can be used as a pet, decoration, or you can even make minigames with it!

    That's it!
    Any question or suggestion, just reply to this thread and I'll answer asap!

    Have fun with the awesome blocks <3
     
    Last edited by a moderator: Nov 1, 2016
    ChipDev likes this.
  2. Offline

    Garris0n

    ChipDev and ase34 like this.
  3. Offline

    LCastr0

  4. Offline

    Garris0n

    -yes
    -yes
    -sounds like a pretty simple modification

    I read the post, you said you found "nothing related". They look pretty related to me.

    Also, unlike this, that one is properly version independent.
     
  5. Offline

    LCastr0

    Well I couldn't edit the fallingblock in that one. It's not related.
    I see you only reply to my threads to make un-usefull comentaries. You should say something related to my project, not about another one. Also, the way it makes the block fly could look like the block is falling if the player lags. My one uses bats to REALLY fly with it, so it prevents any lag bugs.
     
  6. Offline

    Garris0n

    1. I wasn't planning on being quite so negative, I was just pointing out that there was indeed already an extremely similar API (since you hadn't found it. My second post was more negative because your response was negative (and a tad hypocritical).
    2. That one uses the "hologram bug" and does not fall when a player experiences lag.
    3. They're both resources that create non-laggy falling blocks, they're most certainly "related". Each has their drawbacks (that one can't be edited, this one uses questionable NMS practices for an API).
     
  7. Offline

    LCastr0

    Well, this one just re-spawns the new block with the new data and removes the only one, not hard, ofc, but since it would use only like 2 lines of code to change something instead of 10 or 15, its easier.
     
  8. Offline

    Garris0n

    I'm not saying there's anything particularly wrong with the resource (although I haven't actually read through it), I was just trying to point out that there was a similar resource (since you said you couldn't find one). You really should look into doing this, though, as well as perhaps setting up a maven repository.
     
  9. Offline

    LCastr0

    I surely will look into doing that, thanks for the suggestion.
    For the maven repository, I've never made one, don't even know how. I'll try and do some tests before do this one.
    Thanks.
     
  10. Offline

    Garris0n

    There's a hacky way to implement it with GitHub, search around. Otherwise you'll need a server :p
     
  11. Offline

    ampayne2

    Nice library :)
    I noticed this right off the bat, getCreation() is kinda pointless as its not a static method and it just returns the instance - which you already have if you're calling the method :p
     
  12. Offline

    Garris0n

    Not only that, the actual class has a reference to itself as an instance variable. Erm...
     
  13. Offline

    LCastr0

    ampayne2 Garris0n yeah, the Creation class was the last one, and I was kinda tired, and forgot to look at it today. I'll look at it and fix these things. Sorry for that.
    Thanks
     
  14. Offline

    xTrollxDudex

    You link to a mediafire? It's full of ads and viruses, albeit popular with the minecraft client community, use some other service with more dignity, such as DropBox, or use the upload file (not sure if it accepts jars, I'm on an phone right now). Heck, use the tags feature on GitHub and attach a binary to it.
     
  15. Offline

    Garris0n

    This is why I love Adblock, I didn't even know there were ads on it. The whole "mac" thing also helps with the viruses. TIL I shouldn't use MediaFire.
     
    TigerHix likes this.
  16. Offline

    LCastr0

    If you didn't take the time to read, I will upload soon to BukkitDev.

    Changed the way that you get Creation (still the same code, just fixed it), thanks to ampayne2!
    Working on the Maven repository and support for multiple versions, thanks to Garris0n!

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

    ChipDev

    What does a StaticFallingBlock do? Im guessing the variable is static..? Stupid me? :p
     
  18. Offline

    MiniDigger

    @ChipDev it doesn't fall down? ;D
     
    ChipDev likes this.
  19. Offline

    LCastr0

    It doesn't fall or fly, just stay there where you want :p
     
    ChipDev likes this.
Thread Status:
Not open for further replies.

Share This Page