cWindow


Index:
Articles
Classes
Hooks

Quick navigation:
cArrowEntity
cBeaconEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEntity
cEntityEffect
cExpBottleEntity
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLineBlockTracer
cLuaWindow
cMap
cMapManager
cMobHeadEntity
cMobSpawnerEntity
cMojangAPI
cMonster
cNetwork
cNoteEntity
cObjective
cPainting
cPawn
cPickup
cPlayer
cPlugin
cPluginLua
cPluginManager
cProjectileEntity
cRankManager
cRoot
cScoreboard
cServer
cServerHandle
cSignEntity
cSplashPotionEntity
cStatManager
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cTracer
cUDPEndpoint
cUrlClient
cUrlParser
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
sqlite3
TakeDamageInfo
tolua
Vector3d
Vector3f
Vector3i
Globals

Contents


cWindow class

This class is the common ancestor for all window classes used by Cuberite. It is inherited by the cLuaWindow class that plugins use for opening custom windows. It is planned to be used for window-related hooks in the future. It implements the basic functionality of any window.

Note that one cWindow object can be used for multiple players at the same time, and therefore the slot contents are player-specific (e. g. crafting grid, or player inventory). Thus the GetSlot() and SetSlot() functions need to have the cPlayer parameter that specifies the player for whom the contents are to be queried.

Windows also have numeric properties, these are used to set the progressbars for furnaces or the XP costs for enchantment tables.


Inheritance

This class has the following descendants:


Constants

NameValueNotes
wtAnimalChest 11 A horse or donkey window
wtAnvil 8 An anvil window
wtBeacon 7 A beacon window
wtBrewery 5 A brewing stand window
wtChest 0 A chest or doublechest window
wtDropSpenser 3 A dropper or a dispenser window
wtDropper 10
wtEnchantment 4 An enchantment table window
wtFurnace 2 A furnace window
wtHopper 9 A hopper window
wtInventory -1 An inventory window
wtNPCTrade 6 A villager trade window
wtWorkbench 1 A workbench (crafting table) window

Functions

NameParametersReturn valueNotes
GetSlot Player, SlotNumber cItem Returns the item at the specified slot for the specified player. Returns nil and logs to server console on error.
GetWindowID number Returns the ID of the window, as used by the network protocol
GetWindowTitle string Returns the window title that will be displayed to the player
GetWindowType number Returns the type of the window, one of the constants in the table above
GetWindowTypeName string Returns the textual representation of the window's type, such as "minecraft:chest".
IsSlotInPlayerHotbar SlotNum bool Returns true if the specified slot number is in the player hotbar
IsSlotInPlayerInventory SlotNum bool Returns true if the specified slot number is in the player's main inventory or in the hotbar. Note that this returns false for armor slots!
IsSlotInPlayerMainInventory SlotNum bool Returns true if the specified slot number is in the player's main inventory
SetProperty PropertyID, PropartyValue, [Player] Updates a numerical property associated with the window. Typically used for furnace progressbars. Sends the UpdateWindowProperty packet to the specified Player, or to all current clients of the window if Player is not specified.
SetSlot Player, SlotNum, cItem Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid
SetWindowTitle string Sets the window title that will be displayed to the player
Generated on 2016-08-22 23:53:06, Build ID Unknown, Commit approx: 2ed4af74edd14ae17e1c6c64d44caa7b7fc30d5a