Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

addWindow

Comments in 'Plugin Development' started by Skullex, Mar 2, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I have absolutely no experience with adding windows "Inventories" at all. So I need help, anyone know where I can get more information on this. I got this from a recent thread called "Player Inventory" and I still don't clearly understand if I'm doing this right or not.

    PHP:
    <?php

    namespace OpenINV;

    use 
    pocketmine\inventory\PlayerInventory;


    use 
    pocketmine\inventory\FurnaceInventory;


    use 
    pocketmine\inventory\DoubleChestInventory;


    use 
    pocketmine\inventory\ChestInventory;


    use 
    pocketmine\inventory\BrewingInventory;


    use 
    pocketmine\inventory\AnvilInventory;


    use 
    pocketmine\inventory\EnchantInventory;


    use 
    pocketmine\plugin\PluginBase;


    use 
    pocketmine\event\Listener;


    use 
    pocketmine\event\inventory\InventoryOpenEvent;


    use 
    pocketmine\level\sound\AnvilUseSound;


    use 
    pocketmine\level\sound\EndermanTeleportSound;


    use 
    pocketmine\level\sound\ButtonClickSound;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;

    use 
    pocketmine\utils\TextFormat;

    use 
    pocketmine\event\player\PlayerJoinEvent;

    class 
    Main extends PluginBase implements Listener {

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }
     
        public function 
    onJoin(PlayerJoinEvent $event){
                
    $player $event->getPlayer();
                
    $player->addWindow($player->getInventory(PlayerInventory)); //Maybe??
                
    }
            }
    What I'm asking is where would I find out how to do this, unless someone here is willing to show me
    Last edited: Mar 2, 2016
    Muqsit likes this.
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    $player->addWindow($player->getInventory());
    Skullex likes this.
  3. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Back on topic: By window, dont you mean glass?
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I use code blocks... And also, sometimes addWindow has issues, in my case :p
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Thats a PANEL.
  6. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Ok :3
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Sorry for my obsession.
    Code:
    $ grep -i '.*Window.*>:$' < in/mpe0140.asm
    0027c378 <[email protected]>:
    0027c39c <[email protected]>:
    0029e328 <ChatScreen::closeWindow()>:
    002a6d8c <TouchControl::setWindowSize(int, int)>:
    002a77b0 <TouchControlSet::setWindowSize(int, int)>:
    002b6874 <InputHandler::setWindowSize(int, int)>:
    003199f4 <mce::RenderContext::createWindowSizeDependentResources()>:
    0034acac <Screen::supppressedBySubWindow()>:
    003821c4 <InventoryScreen::_closeWindow()>:
    004a5890 <MobEffectsScreen::_closeWindow()>:
    005252c0 <PackedScrollContainer::setWindowResizedFlag(bool)>:
    00578de4 <TouchMapper::setWindowSize(int, int)>:
    0057b0f4 <InputDeviceMapper::setWindowSize(int, int)>:
    005a7fb0 <convertAndroidKeyCodeToWindowsKeyCode(int)>:
    005be8a0 <mce::RenderContextBase::createWindowSizeDependentResources()>:
    0060297a <RakNet::ReliabilityLayer::UpdateWindowFromPacketloss(unsigned long long)>:
    0060297c <RakNet::ReliabilityLayer::UpdateWindowFromAck(unsigned long long)>:
    00608254 <RakNet::CCRakNetSlidingWindow::CCRakNetSlidingWindow()>:
    00608256 <RakNet::CCRakNetSlidingWindow::~CCRakNetSlidingWindow()>:
    00608258 <RakNet::CCRakNetSlidingWindow::Init(unsigned long long, unsigned int)>:
    006082a4 <RakNet::CCRakNetSlidingWindow::Update(unsigned long long, bool)>:
    006082a6 <RakNet::CCRakNetSlidingWindow::GetRetransmissionBandwidth(unsigned long long, unsigned long long, unsigned int, bool)>:
    006082aa <RakNet::CCRakNetSlidingWindow::GetTransmissionBandwidth(unsigned long long, unsigned long long, unsigned int, bool)>:
    006082d8 <RakNet::CCRakNetSlidingWindow::GetNextDatagramSequenceNumber()>:
    006082de <RakNet::CCRakNetSlidingWindow::GetAndIncrementNextDatagramSequenceNumber()>:
    006082ee <RakNet::CCRakNetSlidingWindow::OnSendBytes(unsigned long long, unsigned int)>:
    006082f0 <RakNet::CCRakNetSlidingWindow::OnGotPacketPair(RakNet::uint24_t, unsigned int, unsigned long long)>:
    006082f2 <RakNet::CCRakNetSlidingWindow::OnResend(unsigned long long, unsigned long long)>:
    0060834a <RakNet::CCRakNetSlidingWindow::OnNAK(unsigned long long, RakNet::uint24_t)>:
    00608368 <RakNet::CCRakNetSlidingWindow::OnDuplicateAck(unsigned long long, RakNet::uint24_t)>:
    0060836a <RakNet::CCRakNetSlidingWindow::OnSendAckGetBAndAS(unsigned long long, bool*, double*, double*)>:
    00608372 <RakNet::CCRakNetSlidingWindow::OnSendAck(unsigned long long, unsigned int)>:
    0060837c <RakNet::CCRakNetSlidingWindow::OnSendNACK(unsigned long long, unsigned int)>:
    00608380 <RakNet::CCRakNetSlidingWindow::GetRTOForRetransmission(unsigned char) const>:
    006083d4 <RakNet::CCRakNetSlidingWindow::SetMTU(unsigned int)>:
    006083d8 <RakNet::CCRakNetSlidingWindow::GetMTU() const>:
    006083dc <RakNet::CCRakNetSlidingWindow::GetLocalReceiveRate(unsigned long long) const>:
    006083e8 <RakNet::CCRakNetSlidingWindow::GetRTT() const>:
    00608410 <RakNet::CCRakNetSlidingWindow::GreaterThan(RakNet::uint24_t, RakNet::uint24_t)>:
    0060842e <RakNet::CCRakNetSlidingWindow::OnGotPacket(RakNet::uint24_t, bool, unsigned long long, unsigned int, unsigned int*)>:
    0060849c <RakNet::CCRakNetSlidingWindow::LessThan(RakNet::uint24_t, RakNet::uint24_t)>:
    006084c0 <RakNet::CCRakNetSlidingWindow::GetBytesPerSecondLimitByCongestionControl() const>:
    006084c8 <RakNet::CCRakNetSlidingWindow::GetSenderRTOForACK() const>:
    00608500 <RakNet::CCRakNetSlidingWindow::ShouldSendACKs(unsigned long long, unsigned long long)>:
    00608534 <RakNet::CCRakNetSlidingWindow::IsInSlowStart() const>:
    00608560 <RakNet::CCRakNetSlidingWindow::OnAck(unsigned long long, unsigned long long, bool, double, double, double, bool, RakNet::uint24_t)>:
    0060927c <GetMyIP_Windows_Linux_IPV4(RakNet::SystemAddress*)>:
    00609304 <GetMyIP_Windows_Linux(RakNet::SystemAddress*)>:
    00609308 <RakNet::RNS2_Windows_Linux_360::Send_Windows_Linux_360NoVDP(int, RakNet::RNS2_SendParameters*, char const*, unsigned int)>:
    0076bed4 <_methodGetWindowToken>:
    0076bee0 <_methodGetWindow>:
    0076bf5c <_classWindow>:
    And look at this line in specific:
    Code:
    003821c4 <InventoryScreen::_closeWindow()>:
    And I found a call to this function from the function InventoryScreen::drawIcon(InventoryPaneType, ImageButton), which suggests that this may be the action that happens when a player clicks the "Close" button of the inventory.
    Another call is from InventoryScreen::handleBackEvent(bool), which suggests that this may be the action that happens when a player clicks the "Back" button when opening an inventory, leading to an inventory window closing.
    Another call is from InventoryScreen::_buttonClicked(Button&). Probably the same thing as the first search.
    I also found a call from InventoryScreen::tick(), but I cannot determine what it is about. But since this is the only call left, I guess that this is about closing inventory window when a player gets hurt. Don't have time to make a mod to NOP that instruction to prove it though :p
  8. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Yup I realised After I posed that it doest mean glass xD but thanks for the reference anyway :)
    Oneeb and Legoboy0215 like this.
  9. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Whoops
  10. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Nope, Player Inventory
  11. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    :eek: . . .
  12. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Tiiiiiiiny bit slow on that reply. xD
    Skullex likes this.
  13. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Lmao, sorry :D
  14. MichaelM04
    Offline

    MichaelM04 Active Member Plugin Developer

    Joined:
    Nov 12, 2015
    Posts:
    213
    Plugins:
    1
    Minecraft User:
    Michael
    Just a little :p
    Skullex likes this.
  15. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    :p
  16. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    we can open player inventory in 0.14?
    Skullex likes this.
  17. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Possibly!! :D
  18. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    OMG!! :D
    Skullex likes this.
  19. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Emoji Players...
    Yes if the chest isn't 10 blocks far away from the player.
  20. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    But i mean player inventory not chest inventory :D

Share This Page

Advertisement