summon falling block. ProtocolLib

Discussion in 'Plugin Development' started by 2m3v, Feb 17, 2023.

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

    2m3v

    Help me please summon a falling block. He needs to set the material, but I don't know how. Looks on many forums, but found nothing.

    code (open)

    Code:
    PacketContainer packet = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
    
    packet.getIntegers().write(0, 22);
    packet.getUUIDs().write(0, UUID.randomUUID());
    packet.getEntityTypeModifier().write(0, EntityType.FALLING_BLOCK);
    
    packet.getDoubles()
    .write(0, fallingLoc.getX())
    .write(1, fallingLoc.getY())
    .write(2, fallingLoc.getZ());
     
  2. Offline

    lst96

    To set the material of the falling block, you need to add an int value to the packet that represents the block type. You can do this using the DataWatcher class, which is used to store metadata about entities and can be accessed through the PacketContainer.
     
Thread Status:
Not open for further replies.

Share This Page