5 #include "../FurnaceRecipe.h"
48 virtual bool Tick(std::chrono::milliseconds a_Dt,
cChunk & a_Chunk)
override;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
const cItem & GetSlot(int a_SlotNum) const
cBlockEntityWithItems(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, int a_ItemGridWidth, int a_ItemGridHeight, cWorld *a_World)
void SetSlot(int a_SlotNum, const cItem &a_Item)
bool CanCookInputToOutput(void) const
Returns true if the input can be cooked into output and the item counts allow for another cooking ope...
const cItem & GetInputSlot(void) const
Returns the item in the input slot.
int m_FuelBurnTime
Amount of ticks that the current fuel can burn (in total); zero if no fuel burning.
bool m_IsLoading
Is the block currently being loaded into the world?
void FinishOne()
One item finished cooking.
const cItem & GetFuelSlot(void) const
Returns the item in the fuel slot.
const cFurnaceRecipe::cRecipe * m_CurrentRecipe
The recipe for the current input slot.
virtual void OnRemoveFromWorld() override
Called when the block entity object is removed from a world.
bool m_IsCooking
Set to true if the furnace is cooking an item.
void SetOutputSlot(const cItem &a_Item)
Sets the item in the output slot.
int GetFuelBurnTimeLeft(void) const
Returns the time until the current fuel is depleted, in ticks.
bool HasFuelTimeLeft(void) const
Returns true if there's time left before the current fuel is depleted.
int GetTimeCooked(void) const
Returns the time that the current item has been cooking, in ticks.
void UpdateOutput(void)
Called when the output slot changes.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
void SetLoading(bool a_IsLoading)
int m_NeedCookTime
Amount of ticks needed to fully cook current 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.
int GetCookTimeLeft(void) const
Returns the time until the current item finishes cooking, in ticks.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
int m_TimeBurned
Amount of ticks that the current fuel has been burning.
cItem m_LastInput
The item that is being smelted.
cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Constructor used for normal operation.
void SetIsCooking(bool a_IsCooking)
Sets the m_IsCooking variable, updates the furnace block type based on the value.
void UpdateInput(void)
Updates the recipe, based on the current input.
const cItem & GetOutputSlot(void) const
Returns the item in the output slot.
float m_RewardCounter
Running total of experience that can be picked up.
void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned)
void SetCookTimes(int a_NeedCookTime, int a_TimeCooked)
bool ContinueCooking(void)
Restarts cooking Used after the furnace is loaded from storage to set up the internal variables so th...
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
void BroadcastProgress(size_t a_ProgressbarID, short a_Value)
Sends the specified progressbar value to all clients of the window.
int m_TimeCooked
Amount of ticks that the current item has been cooking.
void UpdateFuel(void)
Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropria...
void BurnNewFuel(void)
Starts burning a new fuel, if possible.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
void SetInputSlot(const cItem &a_Item)
Sets the item in the input slot.
int GetAndResetReward(void)
Calculates, resets, and returns the experience reward in this furnace.
void SetFuelSlot(const cItem &a_Item)
Sets the item in the fuel slot.
void UpdateProgressBars(bool a_ForceUpdate=false)
Broadcasts progressbar updates, if needed.