[API] Flying blocks

Discussion in 'Resources' started by ase34, Mar 21, 2014.

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


    API for developers to create flying and moving blocks

    This API will allow developers to make entities who appear to be a flying block, but are not affected by gravity unlike the ‘regular’ ones. The technique does not require constant cancellation of the gravity (by packets for example) and only uses the connection to the client during an explicit teleport or a change of the velocity.

    The technique is heavily inspired by Asdjke and his Holographic Displays. For further reading, please see the README of the project.

    If you want to use this API, please keep in mind that your pluign then depends on flyingblocksapi and that flyingblocksapi needs to be installed on the server. For downloads, please go to the BukkitDev project page.

    Show Spoiler


    Usage Example:
    Show Spoiler

    To get a quick overview how easy it is to use the API, here's a bit of code spawning a block which constantly rises into the sky. However, there are a few more details you should know in the README.

    1. public class RisingBlockCommandExecutor implements CommandExecutor {
    3. @Override
    4. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    5. // player check
    6. if (!(sender instanceof Player)) {
    7. sender.sendMessage("Only available as player!");
    8. return true;
    9. }
    11. // variables
    12. final double velocity = args.length > 0 ? Double.parseDouble(args[0]) : 0.05;
    14. // constants
    15. final Vector velocityVector = new Vector(0, velocity, 0);
    16. int trackerUpdateInterval = 4;
    17. // we can use a high update interval (0.5 seconds) because the velocity mainly handles the movement
    19. // anonymous class
    20. FlyingBlock block = new FlyingBlock(Material.STONE, (byte) 0, trackerUpdateInterval) {
    21. @Override
    22. public void onTick() {
    23. // set velocity
    24. if (!this.getBukkitEntity().getVelocity().equals(velocityVector)) {
    25. // huh, wrong velocity, override...
    26. this.getBukkitEntity().setVelocity(velocityVector);
    27. }
    28. }
    29. };
    30. // spawn block
    31. block.spawn(((Player) sender).getLocation());
    33. sender.sendMessage(ChatColor.GRAY + "Sucessfully spawned a rising block!");
    34. return true;
    35. }
    37. }

    You just have to add the API to the classpath, but I also provide a maven repository. Please see in the README about more information.

    GrandmaJam, Aqua, TigerHix and 19 others like this.
  2. Offline


    This API is very usefull, Thanks you ;)
    ase34 likes this.
  3. Offline


    axeldu18 Thanks! However, this API was not used in another plugin yet (afaik). I am looking forward to the creations developers might make with this tool.
  4. Offline


    I'll use it in one of my plugin for my server :) For decoration
  5. Offline


    ase34 looks awesome! i did something similar to this where i made a falling sand ride a bat with custom ai with an invisibility potion:)
  6. Offline


    This looks pretty bad ass. The only thing is that the title of the topic bugs me, I'd rather it be, "[API] Flying Blocks." Just personal preference. Other than that, good job. :)
    Garris0n likes this.
  7. Offline


    Why spawning a horse? But otherwise.. I was about to do this D: turns out you beat me to it. Good job on it by the way.
    ase34 likes this.
  8. Offline


    Looks nice, only problem is that the more entities, the higher the lag for weaker computers.
  9. Offline


    Much wow, so cool, way amaze (this is epic!)
    GrandmaJam, JonasXPX and ase34 like this.
  10. Offline


    Good suggestion, I'll change the title right now. :)
  11. Offline


    Did someone actually created something with my API? I would really like to see the results.
  12. Offline


    This is amazing!
  13. Is the wither skull invisible? In that case it woule be possible to make the falling sand entity ride the wither skull directly, wouldn't it?

    Awesome work, anyway!
  14. Offline


    The wither skull is invisible when it has a velocity of 0, however this is setting the velocity of the skull to move the blocks smoothly.
  15. Offline


    Garris0n is absolutely right. However, the actual skull is located 100 blocks above the appearance of the block (using the horses) and thus is too far away to be seen.
    MinecraftShamrock and Garris0n like this.
  16. Offline


    Can I make a shape inside it?
  17. Offline


    Inside what? I'm sorry, but could you please explain a bit more precisely to me?
  18. Offline


    ase34 I meant like a black flag with an 8 inside!
  19. Offline


    Of course, I am currently working on a plugin doing such tasks.
    HeavyMine13 likes this.
  20. Offline


    Could you make a version compatible with 1.6.4?
  21. Offline


    It is quite a good idea making the entire plugin version-independent. Thanks for the idea, I'll try to implement that.
  22. Offline


    It actually is impossible because some of your classes extend a craft class. You can't use reflection to bypass that. I was just wondering if you could make a github for a 1.6.4 version
  23. Offline


  24. Offline


    does anyone know how to recreate that flag?
  25. Offline


    Code, this api, a minecraft server, and a minecraft account
  26. Offline


    Thanks, got it working!
    TigerHix and ArthurMaker like this.
  27. Offline


    Sorry to ask a maybe stupid question but for which Development Build exactly is the latest version of the api made for?
    I always get this Error when the plugin loads up http://pastebin.com/Fz0gXnj1 which then leads to more errors when I try to use the api from my plugin. :oops:

    Suggestion: I sometimes see the horse just for a split second... couldn't you just spawn it with a invisible potion effect with no particle animation and a very large duration? This way the client wouldn't even try to render it...

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


    Ironfan Your information is correct, I made a quite stupid mistake, sorry. (note to self: test plugin first before pushing commit) I'm really sorry for the inconvenience. A working code (hopefully) was already pushed to GitHub (see commit ef23f8f).
  29. Offline


    I think that if the client doesn't render the horse, it would make the blocks fall because the client thinks there is nothing under the blocks.
  30. Offline


    I find that this API cannot handle many flying blocks at once, i attempted to create a space ship out of them and it crashes the server evrytime, and i have it on a timer so its not spawning all the blocks at once
Thread Status:
Not open for further replies.

Share This Page