Discussion in 'Spigot Plugin Development' started by bsn_nick, May 19, 2015.

  1. So: what are the args? I'm guessing World is World, the three doubles are coordinates, but what do I do for IBlockData? Let's say I want a stone block... what would I put? I have s.getType(new BlockPosition(loc.getX(), loc.getY() - 1, loc.getZ()

    the -1 is to set the IBlockData to theblock below the player. I know for sure the entity does not spawn.

    Code (Text):
                final Player player = event.getPlayer();
                Location loc = new Location(event.getPlayer().getWorld(), event.getPlayer().getLocation().getX(), event.getPlayer().getLocation().getY(), event.getPlayer().getLocation().getZ(), event.getPlayer().getLocation().getYaw(), event.getPlayer().getLocation().getPitch());
                WorldServer s = ((CraftWorld)loc.getWorld()).getHandle();
                final EntityFallingBlock e = new EntityFallingBlock(s, loc.getX(), loc.getY(), loc.getZ(), s.getType(new BlockPosition(loc.getX(), loc.getY() - 1, loc.getZ())));
                e.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw());
                PacketPlayOutSpawnEntity packet1 = new PacketPlayOutSpawnEntity(e, 21);
                for (Player players : UtilServer.getPlayers())
    #1 bsn_nick, May 19, 2015
    Last edited: May 19, 2015
  2. Could you be a bit more specific? I don't understand the question, you have a lot of random code and you're just asking "so what are the args"
  3. Well title is EntityFallingBlock(...), and I know what all the args are except for IBlockData. Code was just there in case anyone asked. I want to know how to fill in the IBlockData with a valid arg, so that I can make the EntityFallingBlock a stone fallingblock, or sponge, etc.
  4. Looking at the code for IBlockData you can't instantiate it, it's an abstract class. You have to get it with getType() on Bukkit's WorldServer object.
  5. Didn't you read his post? He knows that already. Watch his code:
    Code (Text):
    s.getType(new BlockPosition(loc.getX(), loc.getY() - 1, loc.getZ()))
    But it doesn't work for him.
    • Agree Agree x 1
  6. Why not using Bukkits FallingBlock?
  7. ...What?
  8. Forgot to mention, it's nms entities being sent with packets.
  9. The type of falling block is defined on packet, not in IBlockData
    So the packet constructor shoud be (entity, 70, type id of block)
    If it result in a wrong entity invert order of 70 and type id
  10. Will try, thank you.