cWindow


Index:
Articles
Classes
Hooks

Quick navigation:
BannerPattern
BossBarColor
BossBarDivisionType
cArrowEntity
cBeaconEntity
cBedEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoat
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cColor
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEnderCrystal
cEntity
cEntityEffect
cExpBottleEntity
cExpOrb
cFallingBlock
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLeashKnot
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
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cUDPEndpoint
cUrlClient
cUrlParser
CustomStatistic
cUUID
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
EffectID
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
SmokeDirection
sqlite3
StatisticsManager
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
PlayercPlayer
SlotNumbernumber
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
SlotNumnumber
boolean
Returns true if the specified slot number is in the player hotbar
IsSlotInPlayerInventory
SlotNumnumber
boolean
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
SlotNumnumber
boolean
Returns true if the specified slot number is in the player's main inventory
SetProperty
PropertyIDnumber
PropertyValuenumber
PlayercPlayer
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
PlayercPlayer
SlotNumnumber
cItemcItem
Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid
SetWindowTitle
WindowTitlestring
Sets the window title that will be displayed to the player
Generated by APIDump on 2024-11-21 00:44:11, Build ID 74, Commit c0f6c97dcea08feb7d5cd1deefc0f6f76eb2cdbd