Bulk clearing of whitespace
This commit is contained in:
@@ -53,21 +53,21 @@ protected:
|
||||
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
|
||||
virtual ~cBlockEntity() {} // force a virtual destructor in all descendants
|
||||
|
||||
|
||||
virtual void Destroy(void) {}
|
||||
|
||||
|
||||
void SetWorld(cWorld * a_World)
|
||||
{
|
||||
m_World = a_World;
|
||||
}
|
||||
|
||||
|
||||
/** Creates a new block entity for the specified block type
|
||||
If a_World is valid, then the entity is created bound to that world
|
||||
Returns nullptr for unknown block types. */
|
||||
static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = nullptr);
|
||||
|
||||
|
||||
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
|
||||
{
|
||||
return "cBlockEntity";
|
||||
@@ -81,9 +81,9 @@ public:
|
||||
|
||||
/** Returns the name of the parent class, or empty string if no parent class. */
|
||||
virtual const char * GetParentClass(void) const { return ""; }
|
||||
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
// Position, in absolute block coordinates:
|
||||
Vector3i GetPos(void) const { return Vector3i{m_PosX, m_PosY, m_PosZ}; }
|
||||
int GetPosX(void) const { return m_PosX; }
|
||||
@@ -91,25 +91,25 @@ public:
|
||||
int GetPosZ(void) const { return m_PosZ; }
|
||||
|
||||
BLOCKTYPE GetBlockType(void) const { return m_BlockType; }
|
||||
|
||||
|
||||
cWorld * GetWorld(void) const { return m_World; }
|
||||
|
||||
|
||||
int GetChunkX(void) const { return FAST_FLOOR_DIV(m_PosX, cChunkDef::Width); }
|
||||
int GetChunkZ(void) const { return FAST_FLOOR_DIV(m_PosZ, cChunkDef::Width); }
|
||||
|
||||
|
||||
int GetRelX(void) const { return m_RelX; }
|
||||
int GetRelZ(void) const { return m_RelZ; }
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
/** Called when a player uses this entity; should open the UI window.
|
||||
returns true if the use was successful, return false to use the block as a "normal" block */
|
||||
virtual bool UsedBy( cPlayer * a_Player) = 0;
|
||||
|
||||
|
||||
/** Sends the packet defining the block entity to the client specified.
|
||||
To send to all eligible clients, use cWorld::BroadcastBlockEntity() */
|
||||
virtual void SendTo(cClientHandle & a_Client) = 0;
|
||||
|
||||
|
||||
/** Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing. */
|
||||
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
@@ -120,12 +120,12 @@ public:
|
||||
protected:
|
||||
/** Position in absolute block coordinates */
|
||||
int m_PosX, m_PosY, m_PosZ;
|
||||
|
||||
|
||||
/** Position relative to the chunk, used to speed up ticking */
|
||||
int m_RelX, m_RelZ;
|
||||
|
||||
BLOCKTYPE m_BlockType;
|
||||
|
||||
|
||||
cWorld * m_World;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ class cBlockEntityWithItems :
|
||||
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cBlockEntityWithItems)
|
||||
|
||||
|
||||
cBlockEntityWithItems(
|
||||
BLOCKTYPE a_BlockType, // Type of the block that the entity represents
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, // Position of the block entity
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
m_Contents.AddListener(*this);
|
||||
}
|
||||
|
||||
|
||||
virtual void Destroy(void) override
|
||||
{
|
||||
// Drop the contents as pickups:
|
||||
@@ -55,12 +55,12 @@ public:
|
||||
m_Contents.Clear();
|
||||
m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); // Spawn in centre of block
|
||||
}
|
||||
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); }
|
||||
const cItem & GetSlot(int a_X, int a_Y) const { return m_Contents.GetSlot(a_X, a_Y); }
|
||||
|
||||
|
||||
void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); }
|
||||
void SetSlot(int a_X, int a_Y, const cItem & a_Item) { m_Contents.SetSlot(a_X, a_Y, a_Item); }
|
||||
|
||||
@@ -68,13 +68,13 @@ public:
|
||||
cItemGrid & GetContents(void) { return m_Contents; }
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
/** Const version of the GetContents() function for C++ type-safety */
|
||||
const cItemGrid & GetContents(void) const { return m_Contents; }
|
||||
|
||||
protected:
|
||||
cItemGrid m_Contents;
|
||||
|
||||
|
||||
// cItemGrid::cListener overrides:
|
||||
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override
|
||||
{
|
||||
|
||||
@@ -18,27 +18,27 @@ class cChestEntity :
|
||||
public cBlockEntityWithItems
|
||||
{
|
||||
typedef cBlockEntityWithItems super;
|
||||
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
ContentsHeight = 3,
|
||||
ContentsWidth = 9,
|
||||
} ;
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cChestEntity)
|
||||
|
||||
|
||||
/** Constructor used for normal operation */
|
||||
cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World, BLOCKTYPE a_Type);
|
||||
|
||||
|
||||
virtual ~cChestEntity();
|
||||
|
||||
// cBlockEntity overrides:
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
|
||||
/** Opens a new chest window for this chest.
|
||||
Scans for neighbors to open a double chest window, if appropriate. */
|
||||
void OpenNewWindow(void);
|
||||
|
||||
@@ -120,7 +120,7 @@ bool cCommandBlockEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_ShouldExecute = false;
|
||||
Execute();
|
||||
return true;
|
||||
@@ -142,7 +142,7 @@ void cCommandBlockEntity::SendTo(cClientHandle & a_Client)
|
||||
void cCommandBlockEntity::Execute()
|
||||
{
|
||||
ASSERT(m_World != nullptr); // Execute should not be called before the command block is attached to a world
|
||||
|
||||
|
||||
if (!m_World->AreCommandBlocksEnabled())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -21,13 +21,13 @@ class cCommandBlockEntity :
|
||||
public cBlockEntity
|
||||
{
|
||||
typedef cBlockEntity super;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cCommandBlockEntity)
|
||||
|
||||
|
||||
/** Creates a new empty command block entity */
|
||||
cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
/** Sets the command block to execute a command in the next tick */
|
||||
void Activate(void);
|
||||
|
||||
|
||||
/** Sets the command */
|
||||
void SetCommand(const AString & a_Cmd);
|
||||
|
||||
@@ -55,9 +55,9 @@ public:
|
||||
|
||||
/** Retrieves the result (signal strength) of the last operation */
|
||||
NIBBLETYPE GetResult(void) const;
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** Executes the associated command */
|
||||
|
||||
@@ -18,19 +18,19 @@ public:
|
||||
// tolua_end
|
||||
|
||||
BLOCKENTITY_PROTODEF(cDispenserEntity)
|
||||
|
||||
|
||||
/** Constructor used for normal operation */
|
||||
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Spawns a projectile of the given kind in front of the dispenser with the specified speed.
|
||||
Returns the UniqueID of the spawned projectile, or 0 on failure. */
|
||||
UInt32 SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_Speed);
|
||||
|
||||
/** Returns a unit vector in the cardinal direction of where the dispenser is facing. */
|
||||
Vector3d GetShootVector(NIBBLETYPE a_Meta);
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
private:
|
||||
|
||||
@@ -71,19 +71,19 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
|
||||
SlotsCnt++;
|
||||
}
|
||||
} // for i - m_Contents[]
|
||||
|
||||
|
||||
if (SlotsCnt == 0)
|
||||
{
|
||||
// Nothing in the dropspenser, play the click sound
|
||||
m_World->BroadcastSoundEffect("random.click", static_cast<double>(m_PosX), static_cast<double>(m_PosY), static_cast<double>(m_PosZ), 1.0f, 1.2f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
|
||||
|
||||
|
||||
// DropSpense the item, using the specialized behavior in the subclasses:
|
||||
DropSpenseFromSlot(a_Chunk, OccupiedSlots[RandomSlot]);
|
||||
|
||||
|
||||
// Broadcast a smoke and click effects:
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
|
||||
int SmokeDir = 0;
|
||||
@@ -120,7 +120,7 @@ bool cDropSpenserEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_ShouldDropSpense = false;
|
||||
DropSpense(a_Chunk);
|
||||
return true;
|
||||
@@ -148,7 +148,7 @@ bool cDropSpenserEntity::UsedBy(cPlayer * a_Player)
|
||||
OpenWindow(new cDropSpenserWindow(m_PosX, m_PosY, m_PosZ, this));
|
||||
Window = GetWindow();
|
||||
}
|
||||
|
||||
|
||||
if (Window != nullptr)
|
||||
{
|
||||
if (a_Player->GetWindow() != Window)
|
||||
|
||||
@@ -34,38 +34,38 @@ public:
|
||||
ContentsHeight = 3,
|
||||
ContentsWidth = 3,
|
||||
} ;
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cDropSpenserEntity)
|
||||
|
||||
|
||||
cDropSpenserEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
virtual ~cDropSpenserEntity();
|
||||
|
||||
|
||||
// cBlockEntity overrides:
|
||||
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should materialize) */
|
||||
void AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & a_BlockZ, NIBBLETYPE a_Direction);
|
||||
|
||||
/** Sets the dropspenser to dropspense an item in the next tick */
|
||||
void Activate(void);
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
protected:
|
||||
bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick
|
||||
|
||||
|
||||
/** Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke / sound effects */
|
||||
void DropSpense(cChunk & a_Chunk);
|
||||
|
||||
|
||||
/** Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...) */
|
||||
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) = 0;
|
||||
|
||||
|
||||
/** Helper function, drops one item from the specified slot (like a dropper) */
|
||||
void DropFromSlot(cChunk & a_Chunk, int a_SlotNum);
|
||||
} ; // tolua_export
|
||||
|
||||
@@ -20,20 +20,20 @@ class cDropperEntity :
|
||||
public cDropSpenserEntity
|
||||
{
|
||||
typedef cDropSpenserEntity super;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cDropperEntity)
|
||||
|
||||
|
||||
/** Constructor used for normal operation */
|
||||
cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
protected:
|
||||
// cDropSpenserEntity overrides:
|
||||
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
|
||||
|
||||
|
||||
/** Takes an item from slot a_SlotNum and puts it into the container in front of the dropper.
|
||||
Called when there's a container directly in front of the dropper,
|
||||
so the dropper should store items there, rather than dropping. */
|
||||
|
||||
@@ -14,12 +14,12 @@ class cEnderChestEntity :
|
||||
public cBlockEntityWindowOwner
|
||||
{
|
||||
typedef cBlockEntity super;
|
||||
|
||||
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cEnderChestEntity)
|
||||
|
||||
|
||||
cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
virtual ~cEnderChestEntity();
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
static void LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid);
|
||||
static void SaveToJson(Json::Value & a_Value, const cItemGrid & a_Grid);
|
||||
|
||||
|
||||
/** Opens a new enderchest window for this enderchest */
|
||||
void OpenNewWindow(void);
|
||||
} ; // tolua_export
|
||||
|
||||
@@ -21,31 +21,31 @@ class cFlowerPotEntity :
|
||||
public cBlockEntity
|
||||
{
|
||||
typedef cBlockEntity super;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cFlowerPotEntity)
|
||||
|
||||
|
||||
/** Creates a new flowerpot entity at the specified block coords. a_World may be nullptr */
|
||||
cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
|
||||
virtual void Destroy(void) override;
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Is a flower in the pot? */
|
||||
bool IsItemInPot(void) { return !m_Item.IsEmpty(); }
|
||||
|
||||
|
||||
/** Get the item in the flower pot */
|
||||
cItem GetItem(void) const { return m_Item; }
|
||||
|
||||
|
||||
/** Set the item in the flower pot */
|
||||
void SetItem(const cItem & a_Item) { m_Item = a_Item; }
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
/** Called when the player is using the entity; returns true if it was a successful use, return false if it should be treated as a normal block */
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
|
||||
@@ -365,7 +365,7 @@ void cFurnaceEntity::UpdateProgressBars(bool a_ForceUpdate)
|
||||
|
||||
int CurFuel = (m_FuelBurnTime > 0) ? 200 - (200 * m_TimeBurned / m_FuelBurnTime) : 0;
|
||||
BroadcastProgress(PROGRESSBAR_FUEL, static_cast<short>(CurFuel));
|
||||
|
||||
|
||||
int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0;
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING_CONFIRM, 200); // Post 1.8, Mojang requires a random packet with an ID of three and value of 200. Wat. Wat. Wat.
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING, static_cast<short>(CurCook));
|
||||
|
||||
@@ -19,25 +19,25 @@ class cFurnaceEntity :
|
||||
public cBlockEntityWithItems
|
||||
{
|
||||
typedef cBlockEntityWithItems super;
|
||||
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
fsInput = 0, // Input slot number
|
||||
fsFuel = 1, // Fuel slot number
|
||||
fsOutput = 2, // Output slot number
|
||||
|
||||
|
||||
ContentsWidth = 3,
|
||||
ContentsHeight = 1,
|
||||
};
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cFurnaceEntity)
|
||||
|
||||
|
||||
/** Constructor used for normal operation */
|
||||
cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World);
|
||||
|
||||
|
||||
virtual ~cFurnaceEntity();
|
||||
|
||||
// cBlockEntity overrides:
|
||||
@@ -54,41 +54,41 @@ public:
|
||||
Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active
|
||||
Returns true if cooking */
|
||||
bool ContinueCooking(void);
|
||||
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Returns the item in the input slot */
|
||||
const cItem & GetInputSlot(void) const { return GetSlot(fsInput); }
|
||||
|
||||
|
||||
/** Returns the item in the fuel slot */
|
||||
const cItem & GetFuelSlot(void) const { return GetSlot(fsFuel); }
|
||||
|
||||
|
||||
/** Returns the item in the output slot */
|
||||
const cItem & GetOutputSlot(void) const { return GetSlot(fsOutput); }
|
||||
|
||||
|
||||
/** Sets the item in the input slot */
|
||||
void SetInputSlot(const cItem & a_Item) { SetSlot(fsInput, a_Item); }
|
||||
|
||||
|
||||
/** Sets the item in the fuel slot */
|
||||
void SetFuelSlot(const cItem & a_Item) { SetSlot(fsFuel, a_Item); }
|
||||
|
||||
|
||||
/** Sets the item in the output slot */
|
||||
void SetOutputSlot(const cItem & a_Item) { SetSlot(fsOutput, a_Item); }
|
||||
|
||||
|
||||
/** Returns the time that the current item has been cooking, in ticks */
|
||||
int GetTimeCooked(void) const { return m_TimeCooked; }
|
||||
|
||||
|
||||
/** Returns the time until the current item finishes cooking, in ticks */
|
||||
int GetCookTimeLeft(void) const { return m_NeedCookTime - m_TimeCooked; }
|
||||
|
||||
|
||||
/** Returns the time until the current fuel is depleted, in ticks */
|
||||
int GetFuelBurnTimeLeft(void) const { return m_FuelBurnTime - m_TimeBurned; }
|
||||
|
||||
|
||||
/** Returns true if there's time left before the current fuel is depleted */
|
||||
bool HasFuelTimeLeft(void) const { return (GetFuelBurnTimeLeft() > 0); }
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned)
|
||||
{
|
||||
m_FuelBurnTime = a_FuelBurnTime;
|
||||
@@ -100,29 +100,29 @@ public:
|
||||
m_NeedCookTime = a_NeedCookTime;
|
||||
m_TimeCooked = a_TimeCooked;
|
||||
}
|
||||
|
||||
|
||||
void SetLoading(bool a_IsLoading)
|
||||
{
|
||||
m_IsLoading = a_IsLoading;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/** Block meta of the block currently represented by this entity */
|
||||
NIBBLETYPE m_BlockMeta;
|
||||
|
||||
/** The recipe for the current input slot */
|
||||
const cFurnaceRecipe::cRecipe * m_CurrentRecipe;
|
||||
|
||||
|
||||
/** The item that is being smelted */
|
||||
cItem m_LastInput;
|
||||
|
||||
/** Set to true when the furnace entity has been destroyed to prevent the block being set again */
|
||||
bool m_IsDestroyed;
|
||||
|
||||
|
||||
/** Set to true if the furnace is cooking an item */
|
||||
bool m_IsCooking;
|
||||
|
||||
|
||||
/** Amount of ticks needed to fully cook current item */
|
||||
int m_NeedCookTime;
|
||||
|
||||
@@ -137,37 +137,37 @@ protected:
|
||||
|
||||
/** Is the block currently being loaded into the world? */
|
||||
bool m_IsLoading;
|
||||
|
||||
|
||||
/** Sends the specified progressbar value to all clients of the window */
|
||||
void BroadcastProgress(short a_ProgressbarID, short a_Value);
|
||||
|
||||
|
||||
/** One item finished cooking */
|
||||
void FinishOne();
|
||||
|
||||
|
||||
/** Starts burning a new fuel, if possible */
|
||||
void BurnNewFuel(void);
|
||||
|
||||
|
||||
/** Updates the recipe, based on the current input */
|
||||
void UpdateInput(void);
|
||||
|
||||
|
||||
/** Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate */
|
||||
void UpdateFuel(void);
|
||||
|
||||
|
||||
/** Called when the output slot changes */
|
||||
void UpdateOutput(void);
|
||||
|
||||
|
||||
/** Returns true if the input can be cooked into output and the item counts allow for another cooking operation */
|
||||
bool CanCookInputToOutput(void) const;
|
||||
|
||||
|
||||
/** Broadcasts progressbar updates, if needed */
|
||||
void UpdateProgressBars(bool a_ForceUpdate = false);
|
||||
|
||||
|
||||
/** Sets the m_IsCooking variable, updates the furnace block type based on the value */
|
||||
void SetIsCooking(bool a_IsCooking);
|
||||
|
||||
|
||||
// cItemGrid::cListener overrides:
|
||||
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
|
||||
|
||||
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
@@ -30,17 +30,17 @@ public:
|
||||
} ;
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cHopperEntity)
|
||||
|
||||
|
||||
/** Constructor used for normal operation */
|
||||
cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
|
||||
/** Returns the block coords of the block receiving the output items, based on the meta
|
||||
Returns false if unattached.
|
||||
Exported in ManualBindings.cpp. */
|
||||
bool GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, int & a_OutputY, int & a_OutputZ);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Int64 m_LastMoveItemsInTick;
|
||||
@@ -50,37 +50,37 @@ protected:
|
||||
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
|
||||
/** Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. */
|
||||
void OpenNewWindow(void);
|
||||
|
||||
/** Moves items from the container above it into this hopper. Returns true if the contents have changed. */
|
||||
bool MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
|
||||
|
||||
|
||||
/** Moves pickups from above this hopper into it. Returns true if the contents have changed. */
|
||||
bool MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
|
||||
|
||||
|
||||
/** Moves items out from this hopper into the destination. Returns true if the contents have changed. */
|
||||
bool MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick);
|
||||
|
||||
|
||||
/** Moves items from a chest (dblchest) above the hopper into this hopper. Returns true if contents have changed. */
|
||||
bool MoveItemsFromChest(cChunk & a_Chunk);
|
||||
|
||||
|
||||
/** Moves items from a furnace above the hopper into this hopper. Returns true if contents have changed. */
|
||||
bool MoveItemsFromFurnace(cChunk & a_Chunk);
|
||||
|
||||
|
||||
/** Moves items from the specified a_Entity's Contents into this hopper. Returns true if contents have changed. */
|
||||
bool MoveItemsFromGrid(cBlockEntityWithItems & a_Entity);
|
||||
|
||||
|
||||
/** Moves one piece from the specified itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack. */
|
||||
bool MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_SrcSlotNum);
|
||||
|
||||
|
||||
/** Moves items to the chest at the specified coords. Returns true if contents have changed */
|
||||
bool MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
|
||||
/** Moves items to the furnace at the specified coords. Returns true if contents have changed */
|
||||
bool MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_HopperMeta);
|
||||
|
||||
|
||||
/** Moves items to the specified ItemGrid. Returns true if contents have changed */
|
||||
bool MoveItemsToGrid(cBlockEntityWithItems & a_Entity);
|
||||
|
||||
|
||||
@@ -16,32 +16,32 @@ class cJukeboxEntity :
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cJukeboxEntity)
|
||||
|
||||
|
||||
cJukeboxEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
virtual ~cJukeboxEntity();
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
int GetRecord(void);
|
||||
void SetRecord(int a_Record);
|
||||
|
||||
|
||||
/** Plays the specified Record. Return false if a_Record isn't a playable Record (E_ITEM_XXX_DISC).
|
||||
If there is a record already playing, ejects it first. */
|
||||
bool PlayRecord(int a_Record);
|
||||
|
||||
|
||||
/** Ejects the currently held record as a pickup. Return false when no record had been inserted. */
|
||||
bool EjectRecord(void);
|
||||
|
||||
|
||||
/** Is in the Jukebox a Record? */
|
||||
bool IsPlayingRecord(void);
|
||||
|
||||
|
||||
static bool IsRecordItem(int a_Item)
|
||||
{
|
||||
return ((a_Item >= E_ITEM_FIRST_DISC) && (a_Item <= E_ITEM_LAST_DISC));
|
||||
}
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
|
||||
@@ -21,36 +21,36 @@ class cMobHeadEntity :
|
||||
public cBlockEntity
|
||||
{
|
||||
typedef cBlockEntity super;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cMobHeadEntity)
|
||||
|
||||
|
||||
/** Creates a new mob head entity at the specified block coords. a_World may be nullptr */
|
||||
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Set the type of the mob head */
|
||||
void SetType(const eMobHeadType & a_SkullType);
|
||||
|
||||
|
||||
/** Set the rotation of the mob head */
|
||||
void SetRotation(eMobHeadRotation a_Rotation);
|
||||
|
||||
|
||||
/** Set the player for mob heads with player type */
|
||||
void SetOwner(const cPlayer & a_Owner);
|
||||
|
||||
/** Sets the player components for the mob heads with player type */
|
||||
void SetOwner(const AString & a_OwnerUUID, const AString & a_OwnerName, const AString & a_OwnerTexture, const AString & a_OwnerTextureSignature);
|
||||
|
||||
|
||||
/** Returns the type of the mob head */
|
||||
eMobHeadType GetType(void) const { return m_Type; }
|
||||
|
||||
|
||||
/** Returns the rotation of the mob head */
|
||||
eMobHeadRotation GetRotation(void) const { return m_Rotation; }
|
||||
|
||||
|
||||
/** Returns the player name of the mob head */
|
||||
AString GetOwnerName(void) const { return m_OwnerName; }
|
||||
|
||||
@@ -62,9 +62,9 @@ public:
|
||||
|
||||
/** Returns the texture signature of the mob head */
|
||||
AString GetOwnerTextureSignature(void) const { return m_OwnerTextureSignature; }
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class cMobSpawnerEntity :
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
cMobSpawnerEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
|
||||
@@ -35,7 +35,7 @@ void cNoteEntity::MakeSound(void)
|
||||
{
|
||||
char instrument;
|
||||
AString sampleName;
|
||||
|
||||
|
||||
switch (m_World->GetBlock(m_PosX, m_PosY - 1, m_PosZ))
|
||||
{
|
||||
case E_BLOCK_PLANKS:
|
||||
@@ -47,7 +47,7 @@ void cNoteEntity::MakeSound(void)
|
||||
sampleName = "note.bassattack";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case E_BLOCK_SAND:
|
||||
case E_BLOCK_GRAVEL:
|
||||
case E_BLOCK_SOULSAND:
|
||||
@@ -56,7 +56,7 @@ void cNoteEntity::MakeSound(void)
|
||||
sampleName = "note.snare";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case E_BLOCK_GLASS:
|
||||
case E_BLOCK_GLASS_PANE:
|
||||
case E_BLOCK_GLOWSTONE:
|
||||
@@ -89,7 +89,7 @@ void cNoteEntity::MakeSound(void)
|
||||
}
|
||||
|
||||
m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, static_cast<Byte>(instrument), static_cast<Byte>(m_Pitch), E_BLOCK_NOTE_BLOCK);
|
||||
|
||||
|
||||
// TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all
|
||||
float calcPitch = static_cast<float>(pow(2.0f, static_cast<float>(m_Pitch - 12.0f) / 12.0f));
|
||||
m_World->BroadcastSoundEffect(
|
||||
|
||||
@@ -31,20 +31,20 @@ public:
|
||||
// tolua_end
|
||||
|
||||
BLOCKENTITY_PROTODEF(cNoteEntity)
|
||||
|
||||
|
||||
/** Creates a new note entity. a_World may be nullptr */
|
||||
cNoteEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
|
||||
virtual ~cNoteEntity() {}
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
char GetPitch(void);
|
||||
void SetPitch(char a_Pitch);
|
||||
void IncrementPitch(void);
|
||||
void MakeSound(void);
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle &) override {}
|
||||
|
||||
|
||||
@@ -20,29 +20,29 @@ class cSignEntity :
|
||||
public cBlockEntity
|
||||
{
|
||||
typedef cBlockEntity super;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
BLOCKENTITY_PROTODEF(cSignEntity)
|
||||
|
||||
|
||||
/** Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr */
|
||||
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
/** Sets all the sign's lines */
|
||||
void SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
|
||||
|
||||
|
||||
/** Sets individual line (zero-based index) */
|
||||
void SetLine(int a_Index, const AString & a_Line);
|
||||
|
||||
/** Retrieves individual line (zero-based index) */
|
||||
AString GetLine(int a_Index) const;
|
||||
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
virtual bool UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user