1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Entity inventory containers - opening and sending

Discussion in 'Development' started by XenialDan, Dec 12, 2017.

  1. XenialDan

    XenialDan Baby Zombie

    Messages:
    141
    GitHub:
    thebigsmilexd
    PHP:
    include("hello.txt");
    Lets talk about entity containers.

    Introduction
    Entity containers, in this thread, reference to entities with inventories that can contain items AND be opened. Example: Minecart with chest.

    Basically, the entity inventory that i construct whilest initialising a class for the Minecart with chest extends ContainerInventory.

    ContainerInventory::class -> onOpen is coded to check if the InventoryHolder is an entity, and sends an entityid in the ContainerOpenPacket.

    onOpen is called by using
    PHP:
    $player->addWindow($inventoryHolder->getInventory());
    , whereas $inventoryHolder is the Minecart instance.

    The issue
    For the server, the inventory constructs and opens fine, even with contents, if wanted.
    The client does not show any reaction though.
    As of that, the server thinks that the player always has the inventory opened and never closes it (because the client sees no inventory to close)

    The question
    Has anyone figured out a way to make MC actually show the inventory?
    For tiles/blockentities it always works fine for me - for actual entities it does not.
    Is there some documentation about opening entities inventories to players?
    Is maybe the ContainerOpenPacket incorrectly en-/decoded and it does not work due to that? (Sub-tagging: @dktapps)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.