5 #include "../BlockArea.h" 6 #include "../Entities/Player.h" 7 #include "../UI/BeaconWindow.h" 8 #include "../ClientHandle.h" 15 super(a_BlockType, a_BlockMeta, a_Pos, 1, 1, a_World),
35 int MinY = std::max(
GetPosY() - 4, 0);
36 int MaxY = std::max(
GetPosY() - 1, 0);
49 for (
int Y = (Area.
GetSizeY() - 1); Y >= 0; Y--)
51 for (
int X = MiddleXZ - Layer; X <= (MiddleXZ + Layer); X++)
53 for (
int Z = MiddleXZ - Layer; Z <= (MiddleXZ + Layer); Z++)
57 return static_cast<char>(Layer - 1);
64 return static_cast<char>(Layer - 1);
85 LOGD(
"%s: Invalid beacon effect: %d", __FUNCTION__, static_cast<int>(a_Effect));
203 (std::abs(Distance.
y) <= 14) &&
204 (std::abs(Distance.
x) <= 20) &&
205 (std::abs(Distance.
z) <= 20)
228 short EffectLevel = 0;
240 if (PlayerPosition.y > BeaconPosition.
y)
242 PlayerPosition.
y = BeaconPosition.
y;
246 if ((PlayerPosition - BeaconPosition).Length() <= Radius)
250 if (HasSecondaryEffect)
291 if ((
GetWorld()->GetWorldAge() % 80) == 0)
306 if (Window ==
nullptr)
312 if (Window !=
nullptr)
bool IsBeaconBlocked(void)
Is the beacon blocked by non-transparent blocks that are higher than the beacon?
eType
All types of entity effects (numbers correspond to protocol / storage types)
cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
BLOCKTYPE GetBlock(Vector3i a_BlockPos)
Returns the block type at the specified position.
cWorld * GetWorld() const
void CopyFrom(const cItemGrid &a_Src)
Copies all items from a_Src to this grid.
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...
unsigned int AwardAchievement(const eStatistic a_Ach)
Awards the player an achievement.
void GiveEffects(void)
Give the near-players the effects.
unsigned char BLOCKTYPE
The datatype used by blockdata.
cEntityEffect::eType m_SecondaryEffect
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
static bool IsMineralBlock(BLOCKTYPE a_BlockType)
Returns true if the block is a diamond block, a golden block, an iron block or an emerald block...
cEntityEffect::eType m_PrimaryEffect
void OpenWindow(cWindow *a_Window)
char CalculatePyramidLevel(void)
Calculate the amount of layers the pyramid below the beacon has.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
void UpdateBeacon(void)
Update the beacon.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
cWindow * GetWindow(void) const
void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier=1)
Applies an entity effect.
BLOCKTYPE GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) const
static bool IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLevel)
Returns true if the effect can be used.
void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity)
Vector3i m_Pos
Position in absolute block coordinates.
virtual void SetProperty(short a_Property, short a_Value)
Updates a numerical property associated with the window.
static bool IsTransparent(BLOCKTYPE a_Type)
bool Read(cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes=baTypes|baMetas|baBlockEntities)
Reads an area of blocks specified.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
bool SetSecondaryEffect(cEntityEffect::eType a_Effect)
Sets the secondary effect.
bool SetPrimaryEffect(cEntityEffect::eType a_Effect)
Sets the primary effect.
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
virtual bool ForEachPlayer(cPlayerListCallback a_Callback) override
Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true.