ArmorStand don't show ItemStack

Discussion in 'Spigot Plugin Development' started by Dcgames, May 13, 2017.

  1. Hello, I'm trying to show a Floating Item on ArmorStand. But when I test the plugin it don't show the Item.
    I'm using Spigot 1.8.3 and Minecraft 1.8.9

    Code (Text):
    armorstand.setHelmet(new ItemStack(Material.SKULL, 1));
                new BukkitRunnable() {
                 
                    @Override
                    public void run() {
                        armorstand.getLocation().setYaw(armorstand.getLocation().getYaw() + 20);
                    }
                }.runTaskTimer(Main.getInstance(), 20, 2 * 20);
     
    Thank you.
     
  2. what do you mean by "it don't show the item" have you spawned the armorstand? is the location you are searching for the armorstand correct?
    Also this: " armorstand.getLocation().setYaw(armorstand.getLocation().getYaw() + 20);" won't do any changes until you apply the new location to the armorstand
     
  3. I mean, I put a name on armorStand just to test and below the name It was to appear the item, <armorstand.setHelmet(new ItemStack(Material.SKULL, 1));> This line.
    But It just show the armorStand name. And don't show the item below name.
     
  4. I haven't had this kind of problems, but maybe showing the rest of your code (the lines which have something to do with the armorStand variable) will help us in identifying the problem.
     
  5. Here my code, I think this is all about the ArmorStand config:

    Code (Text):
    ArmorStand armorstand = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
                armorstand.setVisible(false);
                armorstand.setGravity(false);
                armorstand.setCustomNameVisible(true);
                armorstand.setCustomName("test name");
                armorstand.add(armorstand);
                this.armorstand = armorstand;
               
                armorstand.setHelmet(new ItemStack(Material.SKULL));
                new BukkitRunnable() {
                   
                    @Override
                    public void run() {
                        armorstand.getLocation().setYaw(armorstand.getLocation().getYaw() + 20);
                    }
                }.runTaskTimer(Main.getInstance(), 20, 2 * 20);
     
  6. Just asking, what do you want with this?

    Code (Text):

                armorstand.add(armorstand);
     
     
  7. Can you see the armor in the world? With F3 + B ?
     
  8. Cause is a private class, So I add it on a public method, But I change the name is:

    //armorEntity is a variable on method
    armorstand.add(armorEntity);
     
  9. Yeah, I can see. But I don't see the block on ArmorStand Helmet
     
  10. Change this:

    Code (Text):

                armorstand.setHelmet(new ItemStack(Material.SKULL));
     
    to

    Code (Text):

                armorstand.setHelmet(new ItemStack(Material.SKULL_ITEM));
     
    As "SKULL" is the block state and "SKULL_ITEM" is the correct item material.
     
  11. Yeah, worked. But how can I make floating item? like rotate an item or something
     
  12. So you want the Item.class entity or what? Or do you mean by rotating the head with the EulerAngle
     
  13. Do you know when you drop an item. I wanted like that event, but on a ArmorStand
     
  14. Sounds like he wants the item like it would look after you tossed it on the ground but rotating like some of the shops do.

    Edit: Typing slow today sorry :p
     
  15. Not sure what you mean by that, so you want when you drop the item, the item as the helmet at the armorstand?

    Edit: Or do you want to be displaying a custom name to the item when its on ground
     
  16. Doesn't the holograms plugin do this already? And I think it has an api...
     
  17. Basically when he wanna create custom items with a custom name on ground then there's no need for armorstands, i made a similar plugin here by using the Item.class > setCustomName(String) function
     
  18. You won't be able to perfectly replicate item drops that way - the blocks when set to the helmet will be much bigger (though there's scaling, but even then there's probably better solutions)

    What's your end-goal?
     
  19. Hey thats cute and useful @Phloxy Kudos!
     
  20. You could spawn a block in the air and spawn the item on top of it, then for every player:

    player.sendBlockChange(blockLocation, 0, (byte) 0);

    This will make it look like there is no block there, but I'm not sure how the item will react to that, it might fall through client-side and keep glitching back up. Also make sure not to walk into the invisible block as you might get kicked for flying