47 lines
2.0 KiB
C++
47 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "ActionFile.h"
|
|
#include "botcraft/Game/Vector3.hpp"
|
|
|
|
namespace Botcraft
|
|
{
|
|
class EntityManager;
|
|
class ItemFrameEntity;
|
|
}
|
|
namespace ProtocolCraft
|
|
{
|
|
class ServerboundInteractPacket;
|
|
}
|
|
|
|
namespace Bilicraft
|
|
{
|
|
// Protocol 774: the command names the SUPPORT block; the frame's network
|
|
// spawn position is an integer attachment cell (support + outward face normal),
|
|
// but absolute movement/sync can replace it with the actual frame center.
|
|
// Invalid commands throw. Malformed frame positions/directions do not match.
|
|
bool MatchesItemFrame(const Botcraft::ItemFrameEntity &frame, const ActionCommand &command);
|
|
|
|
// Only ordinary/glow item frames qualify. Zero matches returns nullptr;
|
|
// multiple matches (including on one explicit face) throw instead of guessing.
|
|
// The manager lock is released before this returns; callers must revalidate
|
|
// identity/position immediately before sending, particularly after yielding.
|
|
std::shared_ptr<Botcraft::ItemFrameEntity> FindItemFrame(Botcraft::EntityManager &manager,
|
|
const ActionCommand &command);
|
|
|
|
// Visual/collision center, NOT the spawn position. Throws for invalid state.
|
|
// Suitable for LookAt and conservative eye-to-center reach checks.
|
|
Botcraft::Vector3<double> ItemFrameCenter(const Botcraft::ItemFrameEntity &frame);
|
|
|
|
// Read-only, bounded diagnostic: loaded count and at most eight nearby frames
|
|
// with raw position, direction and decoded support. Never selects a fallback.
|
|
std::string DescribeItemFrameTargets(Botcraft::EntityManager &manager, const ActionCommand &command);
|
|
|
|
// Action 0 + main hand for ordinary right-click, Action 1 without a hand for
|
|
// attack; never interact-at (Action 2). Secondary is the actual sneaking state.
|
|
std::shared_ptr<ProtocolCraft::ServerboundInteractPacket> MakeEntityInteractionPacket(int entityId, bool attack,
|
|
bool secondary);
|
|
} // namespace Bilicraft
|