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()); e.setCustomName(player.getName()); e.setCustomNameVisible(true); PacketPlayOutSpawnEntity packet1 = new PacketPlayOutSpawnEntity(e, 21); for (Player players : UtilServer.getPlayers()) { ((CraftPlayer)players).getHandle().playerConnection.sendPacket(packet1); }
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"
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.
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.
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.
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