14 #include "../UI/WindowOwner.h" 60 virtual void DoSetSpeed(
double a_SpeedX,
double a_SpeedY,
double a_SpeedZ)
override;
108 const
cItem & GetContent(
void)
const {
return m_Content;}
144 const cItem &
GetSlot(
int a_Idx)
const {
return m_Contents.GetSlot(a_Idx); }
145 void SetSlot(
int a_Idx,
const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); }
151 void OpenNewWindow(
void);
158 ASSERT(a_Grid == &m_Contents);
161 if (GetWindow() !=
nullptr)
163 GetWindow()->BroadcastWholeWindow();
191 virtual
void Tick(
std::chrono::milliseconds a_Dt,
cChunk & a_Chunk) override;
194 void SetIsFueled(
bool a_IsFueled,
int a_FueledTimeLeft = -1) {m_IsFueled = a_IsFueled; m_FueledTimeLeft = a_FueledTimeLeft;}
int GetChunkZ(void) const
virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override
Does the actual speed-setting.
bool TestBlockCollision(NIBBLETYPE a_RailMeta)
Tests if a solid block is in front of a cart, and stops the cart (and returns true) if so; returns fa...
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Handles the physics of the entity - updates position based on speed, updates speed based on environme...
const cItem & GetSlot(int a_Idx) const
virtual void OnSlotChanged(cItemGrid *a_Grid, int a_SlotNum) override
Called whenever a slot changes.
ePayload GetPayload(void) const
void HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
Handles powered rail physics Each tick, speed up or slow down cart, depending on metadata of rail (po...
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
int LastDamage(void) const
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
void HandleDetectorRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt)
Handles detector rail activation Activates detector rails when a minecart is on them.
This class is used as a callback for when a slot changes.
cMinecart(ePayload a_Payload, Vector3d a_Pos)
void MarkChunkDirty(int a_ChunkX, int a_ChunkZ)
int GetFueledTimeLeft(void) const
double m_Height
Height of the entity (Y axis)
void SnapToRail(NIBBLETYPE a_RailMeta)
Snaps a mincecart to a rail's axis, resetting its speed For curved rails, it changes the cart's direc...
int GetBlockHeight(void) const
ePayload
Minecart payload, values correspond to packet subtype.
bool TestEntityCollision(NIBBLETYPE a_RailMeta)
Tests if this mincecart's bounding box is intersecting another entity's bounding box (collision) and ...
void HandleActivatorRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt)
Handles activator rails - placeholder for future implementation.
virtual bool DoTakeDamage(TakeDamageInfo &TDI) override
Makes this entity take damage specified in the a_TDI.
virtual void OnRightClicked(cPlayer &a_Player)
Called when the specified player right-clicks this entity.
bool IsSolidBlockAtOffset(int a_XOffset, int a_YOffset, int a_ZOffset)
Tests if a solid block is at a specific offset of the minecart position.
int GetChunkX(void) const
bool IsFueled(void) const
void ApplyAcceleration(Vector3d a_ForwardDirection, double a_Acceleration)
Applies an acceleration to the minecart parallel to a_ForwardDirection but without allowing backward ...
cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height)
virtual void Destroyed() override
Vector3i m_DetectorRailPosition
#define CLASS_PROTODEF(classname)
void SetSlot(int a_Idx, const cItem &a_Item)
Window owner that is associated with an entity (chest minecart etc.)
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
void HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt)
Handles physics on normal rails For each tick, slow down on flat rails, speed up or slow down on asce...