5 #include "../Bindings/PluginManager.h"
6 #include "../UI/BrewingstandWindow.h"
7 #include "../Entities/Player.h"
15 Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
45 if (Window !=
nullptr)
48 Window->OwnerDestroyed();
114 for (std::size_t i = 0; i < 3; i++)
145 if (Window ==
nullptr)
151 if (Window !=
nullptr)
178 if (Window !=
nullptr)
231 for (std::size_t i = 0; i < 3; i++)
233 if (
GetSlot(
static_cast<int>(i)).IsEmpty())
251 if (Recipe !=
nullptr)
320 for (std::size_t i = 0; i < 3; i++)
322 if (
GetSlot(
static_cast<int>(i)).IsEmpty())
327 if (Recipe !=
nullptr)
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
@ InteractWithBrewingstand
static cPluginManager * Get(void)
Returns the instance of the Plugin Manager (there is only ever one)
bool CallHookBrewingCompleted(cWorld &a_World, cBrewingstandEntity &a_Brewingstand)
Vector3i m_Pos
Position in absolute block coordinates.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
const cItem & GetSlot(int a_SlotNum) const
virtual void OnSlotChanged(cItemGrid *a_Grid, int a_SlotNum) override
Called whenever a slot changes.
bool m_IsBrewing
Set to true if the brewing stand is brewing an item.
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking.
short m_RemainingFuel
The remaining fuel for the brewing stand.
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
void ContinueBrewing(void)
Starts the brewing proccess.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
void LoadRecipes(void)
Gets the recipes.
virtual void OnRemoveFromWorld() override
Called when the block entity object is removed from a world.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
std::array< const cBrewingRecipes::cRecipe *, 3 > m_CurrentBrewingRecipes
Store the current brewing recipes.
void BroadcastProgress(size_t a_ProgressbarID, short a_Value)
Sends the specified progressbar value to all clients of the window.
void UpdateProgressBars(bool a_ForceUpdate=false)
std::array< cItem, 3 > m_Results
Result items for the bottle inputs.
const short m_NeedBrewingTime
Brewing time is 400 ticks.
cBrewingstandEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Constructor used for normal operation.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
short m_TimeBrewed
Amount of ticks that the current item has been brewed.
const cRecipe * GetRecipeFrom(const cItem &a_Input, const cItem &a_Ingredient) const
Returns a recipe for the specified input, nullptr if no recipe found.
StatisticsManager & GetStatistics()
Return the associated statistic and achievement manager.
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
cWindow * GetWindow(void)
bool IsEmpty(void) const
Returns true if the item represents an empty stack - either the type is invalid, or count is zero.
bool IsEqual(const cItem &a_Item) const
cItem CopyOne(void) const
Returns a copy of this item with m_ItemCount set to 1.
void SetSlot(int a_X, int a_Y, const cItem &a_Item)
const cItem & GetSlot(int a_X, int a_Y) const
void AddListener(cListener &a_Listener)
Adds a callback that gets called whenever a slot changes.
cBrewingRecipes * GetBrewingRecipes(void)
std::unordered_map< CustomStatistic, StatValue > Custom
virtual void SetProperty(size_t a_Property, short a_Value)
Updates a numerical property associated with the window.
cWindow * GetWindow(void) const
void OpenWindow(cWindow *a_Window)
cTickTimeLong GetWorldTickAge() const
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override