Hologram over chest

Discussion in 'Plugin Development' started by Glass_Eater84, Aug 17, 2014.

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

    Glass_Eater84

    Hey everyone,
    I am wondering how I can set a hologram over a chest when a player dies. So, the hologram would say (player that died) loot! Then once the chest is open it will go away.
     
  2. Offline

    Windy Day

    Oneway would be to use one of the many hologram utils from the resource section to create your holograms. Next listen for when a player dies when one does create at chest at their location and fill it with their inventory and then use the described methods in the resource your choose to use to create an hologram at the player's eye location (which is one block above their normal location). You will probably have to store the location of this chest and the hologram in a hashmap so you can correctly remove corresponding chests and holograms. After you do that make an event listening for when a player opens a chest and when this event is fired get the chests location and get the hologram that goes with that chest from the hashmap and remove it using the hologram utils described method.
     
  3. Offline

    fireblast709

    Wasn't there also a trick regarding spawning a clientside bat inside the chest?
     
  4. Offline

    Glass_Eater84

  5. Offline

    GeorgeeeHD

    Glass_Eater84

     
  6. Offline

    Glass_Eater84

    I mean that maybe cause lag fireblast709
    I am trying to work it into this:

    Code:java
    1. @EventHandler
    2. public void playerDeath(PlayerDeathEvent e){
    3. e.getDrops().clear();
    4. ItemStack[] inv = e.getEntity().getInventory().getContents();
    5. Location loc = e.getEntity().getLocation();
    6. loc.getBlock().setType(Material.CHEST);
    7. Block chest = loc.getBlock();
    8. BlockState state = chest.getState();
    9. Chest c = (Chest) state;
    10. if (inv.length >= 27){
    11. chest.getRelative(BlockFace.NORTH).setType(Material.CHEST);
    12. }
    13. c.getInventory().clear();
    14. c.getInventory().setContents(inv);
     
  7. Offline

    fireblast709

    Glass_Eater84 you would spawn one clientside (with the help of packets). I cannot see how that would cause any lag lol.
     
  8. Offline

    Windy Day

    Yeah that was what people came up with before holograms. It use to be spawn the small animal in the chest then set its name and it looked like a nametag for the chest. But now it might be more convenient to use holograms now.
     
  9. Offline

    fireblast709

    Windy Day In fact, holograms use two entities, whereas the old trick uses one. Also it it less likely to be patched (probably 0 chance for the bat trick)
     
  10. Offline

    Windy Day

    fireblast709 Yeah I know it uses entities also. I just suggested it because I thought that for Glass_Eater's case the easiest way would be to use a hologram util's methods rather than try to figure packets. Although the bat trick is a very good alternative.
     
  11. Offline

    Glass_Eater84

    Windy Day fireblast709 Im not being asked to be code fed but can you please show me an example? I also want it go away after they open it.

    bump

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

    Glass_Eater84

  13. Offline

    joeygallegos

    Glass_Eater84 You should try looking at some of the source HologramsAPI uses on Github. Though it may take some work and good knowledge of Java, you may find the result you need!
     
  14. Offline

    Gater12

Thread Status:
Not open for further replies.

Share This Page