Spawning a Falling Block with Packets

Discussion in 'Spigot Plugin Help' started by Rayn322, Jun 17, 2021.

  1. I'm trying to spawn a falling block that just hovers in place with packets. Although whenever I spawn the block, it only creates a shadow that quickly disappears a split second later. Here's my code:
    Code (Java):
    public static void spawnFallingBlock(Location location, Material material) {
        CraftWorld world = (CraftWorld) location.getWorld();
        EntityFallingBlock fallingBlock = new EntityFallingBlock(world.getHandle(), location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).getBlockData());
        PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(fallingBlock);
        for (Player player : Bukkit.getOnlinePlayers()) {
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  2. I think in Minecraft in general fallingSand (which is a falling block) always disappears after you just summoned it. I think you need to make a loop to summon them and calculate the gravity yourself. I am not 100% sure though.

    Also, I think this thread should be posted in the Spigot Development Help forums, not the Spigot Plugin Help Forums, but the titling of the forums is a little confusing.
  3. Thanks! I didn't even notice the Spigot Development Help section lmao.