Code: @EventHandler(priority=EventPriority.HIGHEST) public void onPlayerUse(PlayerInteractEvent e){ Player player = e.getPlayer(); if(player.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("§4§lMickey Balloon")){ Location location = player.getEyeLocation().add(0.0D, 5.0D, 0.0D); FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(location, Material.SKULL_ITEM, (byte)3); Bat bat = (Bat)player.getWorld().spawn(location, Bat.class); bat.setPassenger(fallingBlock); bat.setLeashHolder(player); player.setPassenger(bat); bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 100000)); bat.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 100000)); } } } Im trying to make a Mickey Balloon, But this wont spawn or work. I have the ItemStack in a different class. I can't get the spawnFallingBlock tobe the Mickey head and It won't spawn. (I want it to stay move the player when its held) does anyone have any ideas?
@FloopThatGuy5 https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/World.html#spawnFallingBlock(org.bukkit.Location, org.bukkit.Material, byte) "The Material must be a block type, check with material.isBlock(). The Material may not be air." A SKULL_ITEM is no block, a Material.SKULL is. I hope this helps, i haven't tested it.
@I Al Istannen Thankyou, That link does not work, How do I set the Mickey head tobe the block, and do u know why it wont spawn?
@FloopThatGuy5 Now it works ;D Strange... Replace the "Material.SKULL_ITEM" with "MATERIAL.SKULL" to get the block material. This can be used to set the type of the falling block.
@I Al Istannen Sorry to keep bothering you, Im kinda a noob. How do I set the block head. and It still won't spawn
@FloopThatGuy5 I have tried it and it turned out, that the falling block gets spawned and places a block where it lands, but doesn't get shown falling. I don't really know why that happens ;/ It works with the other blocks I have tested though. EDIT: If you do this on 1.8 you can use an armorstand to display it.