Witherskull Exploding

Discussion in 'Plugin Development' started by sethrem, Dec 22, 2014.

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

    sethrem

    Hello,
    I'm trying to create a floating item but when I do the wither skull explodes. I've done everything in the guide below but It still explodes.

    http://bukkit.org/threads/floating-entities-frozen-entities-floating-items.313439/
    Code:
                    WitherSkull skull = (WitherSkull) p.getWorld().spawn(p.getLocation().add(0, -6, 0), WitherSkull.class);
                    skull.setDirection(new Vector(0, 0, 0));
                    skull.setVelocity(new Vector(0, 0, 0));
                    Entity item = p.getWorld().dropItemNaturally(p.getLocation().add(0, -6, 0), new ItemStack(Material.MELON));
                    skull.setPassenger(item);
    Thanks in advanced.
     
    ChipDev likes this.
  2. Offline

    Jaaakee224

  3. You could add the skull to a arraylist and cancel the EntityExplodeEvent (Wrote it right?) if the entity is the entity in the arraylist
     
  4. Offline

    sethrem

  5. Offline

    Cycryl

    @sethrem When the witherskull is spawned it instantly collides with the player.
    try instead using
    WitherSkull ws = player.lauchProjectile(WitherSkull.class);
     
  6. or use a invisible and invincible squid, they make no noises
     
  7. Offline

    sethrem

    @FisheyLP do they fly? Like is it possible to make them float?
     
  8. Offline

    Jaaakee224

    @sethrem
    I've tried that resource before and I didn't like it at all. I didn't want to use an API either but I found that it was amazing. Try it.
     
  9. Offline

    Skionz

    You already are :p
     
    teej107 and Konato_K like this.
  10. Offline

    sethrem

    @Skionz Well like I don't want to use an Api for holograms other than bukkit silly. :p
     
    Skionz likes this.
  11. Offline

    Skionz

    Your using the Java API as well (probably)
     
    Last edited: Dec 23, 2014
    sethrem likes this.
  12. Offline

    sethrem

  13. Offline

    ChipDev

    Explosions? It collides with the player probably. Ill look into this, same thing happened with me and I fixed it!
     
  14. Offline

    sethrem

    @ChipDev Alright thanks bro, would appreciate it if you found out why this happens, because I've been hacking at this for about 1 day now and no new results.
     
  15. Offline

    Skionz

  16. Offline

    sethrem

  17. Offline

    xTigerRebornx

    @sethrem The WitherSkull and the Item collide, thus blowing it up. Either use the API, Packets, or Custom Entities. The API saves the trouble of you having to work with NMS, and the other two require you to know what you are doing when it comes to NMS (which is not easy)
     
  18.  
  19. Offline

    sethrem

    @FisheyLP doesn't work I tried.

    @xTigerRebornx I've tried making a custom entity and I've overridden every single method for the skull and still it explodes.

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Dec 24, 2014
  20. Offline

    ChipDev

    Know it works with boats. Try an Invisible squid
     
  21. Offline

    sethrem

  22. Offline

    ChipDev

    I bet on WitherSkulls.
     
  23. Offline

    sethrem

  24. Offline

    ChipDev

    From my old floating boat:
    Code:
    package com.chip;
    
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.WitherSkull;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.Vector;
    
    public class Rolley extends JavaPlugin implements Listener {
       
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
        }
        public void spawnBoat(Player p) {
            WitherSkull skull = (WitherSkull) p.getWorld().spawn(p.getLocation(), WitherSkull.class);
            skull.setDirection(new Vector(0, 0, 0));
            skull.setVelocity(new Vector(0, 0, 0));
            Entity boat = p.getWorld().spawnEntity(p.getLocation().add(0, -1, 0), EntityType.BOAT);
            skull.setPassenger(boat);
        }
        @EventHandler
        public void onPlayerMoveEvent(PlayerMoveEvent e) {
            spawnBoat(e.getPlayer());
        }
    
    }
    
     
  25. Offline

    Konato_K

    @sethrem About overriding, I think WitherSkulls explode because they inherit from Fireball (Or whatever the class is called)
     
  26. Offline

    sethrem

  27. Offline

    Experminator

  28. Offline

    TheYamsMan

    @sethrem Assuming you are summoning the skull at the player's location, couldn't you just summon the wither skull a block in front of the player or something?
     
  29. Offline

    xTigerRebornx

    @sethrem If you are unable to get custom entities to work, spawn mobs using packets. No server side logic is done, they don't blow up, and can be modified to your liking
     
  30. Offline

    sethrem

    @Experminator That won't work already tried all those methods, but thanks.

    @TheYamsMan Already tried this didn't work, but thanks.

    @xTigerRebornx How would I go on about doing this? Thanks in advanced.
     
Thread Status:
Not open for further replies.

Share This Page