Solved Floating block?

Discussion in 'Plugin Development' started by kampai, May 14, 2016.

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

    kampai

    How would I do something like this, I know how to do the holograms but the floating blocks?
    upload_2016-5-14_16-27-0.png
     
  2. That is just a dropped item which doesnt have gravity (maybe cancel any move events for this Item entity) and which can't be picked up (cancel pickup events).
     
  3. Offline

    I Al Istannen

    @Kage0x3B @kampai
    Maybe an Item entity riding an invisible armorstand? You could install some sort of "hack" like "Omniscience" and see for youself what is going on. (I do hope that is no against these forum rules, but I don't see why it could.)
    To stop picking it up, you might also be able to set the pickup delay.
     
    Last edited: May 14, 2016
  4. Offline

    Zombie_Striker

    @kampai @Kage0x3B
    It actually seems like its an invisible armourstand that is holding an item.
     
  5. Offline

    I Al Istannen

    @Zombie_Striker
    Then the item doesn't rotate, which is boring ;) But you can easily be right. No way to judge it from an image, as far as I know.
     
    ChipDev likes this.
  6. Offline

    DoggyCode™

    Could someone put the image on gyazo or imugur? Won't load the file on my phone thanks.

    Sent from my SM-N9005 using Tapatalk
     
  7. Offline

    kampai

    In-game the item is rotating so it's most likely a dropped item, now that I have an idea I'll try to code it, thanks to everyone that helped
     
  8. Offline

    Zombie_Striker

    @kampai
    1. Create a new dropped item.
    2. Add a by using Entity.setMetaData, where the tag will have "nogravity" set to true.
    3. Set the item's location to be wherever you want it to float.
     
  9. Offline

    kampai

    I'm kinda confused on #2, I've never set an item to nogravity before, so how do i get the same entity that is being dropped to set that to nograv, because I'm dropping an Itemstack so it only gets recognized as an entity once its actually dropped
     
  10. Offline

    Zombie_Striker

    @kampai
    To get the entity's instance, use the following line when you create the item.
    Code:
    Entity droppeditem = World.dropItem(.....);
    When you want to add the nogravity tag use the following line (note: have not tested it yet. )
    Code:
    droppeditem.setMetadata(new MetaDataValue(true));
     
  11. Offline

    I Al Istannen

    @Zombie_Striker
    The noGravity tag only works on ArmorStands as far as I know. "nogravity" or "noGravity" or "NoGravity" didn't work. But you would need to add them as a NBT tag anyways, wouldn't you? Your method adds metaData other plugins can read, but nothing that modifies the entity attributes.

    This is just how I understood it, so if something works different, point it out.


    @kampai
    Setting the item as the passenger of an invisible ArmorStand with setGravity(false) looks like this (it rotates). You just need to set the pickupDelay to a really high value (e.g. Integer.MAX_VALUE) or cancel the pickup events.

    Floating Item.png
     
  12. Offline

    ChipDev

  13. Offline

    I Al Istannen

    @ChipDev
    Hmm. Witherskulls were used as markes before ArmorStands. Armorstands are a lot safer though. They won't glitch or explode :p. And with the marker tag, they shouldn't even be rendered (afaik). In 1.9 AreaEffectClouds are also used, at least I saw some videos using them (CommandBlocks though).

    But yes, also possible ;)
     
    ChipDev likes this.
Thread Status:
Not open for further replies.

Share This Page