Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
BlockNamedTickEventManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/platform/brstd/function_ref.h"
7#include "mc/world/level/ChunkBlockPos.h"
8#include "mc/world/level/Tick.h"
9#include "mc/world/level/block/BlockQueuedNamedTickEvent.h"
10
11// auto generated forward declare list
12// clang-format off
13class BlockSource;
14class BlockType;
16class BoundingBox;
17class CompoundTag;
18class LevelChunk;
19// clang-format on
20
21class BlockNamedTickEventManager {
22public:
23 // BlockNamedTickEventManager inner types declare
24 // clang-format off
25 struct EventCompare;
26 struct EventWithDelay;
27 // clang-format on
28
29 // BlockNamedTickEventManager inner types define
30 enum class Result : int {
31 Success = 0,
32 NoEventsHandled = 1,
33 CreationTimeBeforeCurrentTick = 2,
34 EmptyNamespace = 3,
35 TooManyEventsAtPosition = 4,
36 NamespaceHashCollision = 5,
37 InvalidEvent = 6,
38 };
39
40 struct EventCompare {};
41
42 struct EventWithDelay {
43 public:
44 // member variables
45 // NOLINTBEGIN
51 // NOLINTEND
52
53 public:
54 // prevent constructor by default
55 EventWithDelay& operator=(EventWithDelay const&);
56 EventWithDelay(EventWithDelay const&);
57 EventWithDelay();
58 };
59
60 using EventQueue = ::std::multiset<::BlockQueuedNamedTickEvent, ::BlockNamedTickEventManager::EventCompare>;
61
62 using NamespaceMap = ::std::unordered_map<uint, ::std::string>;
63
64 using PositionEvents = ::std::vector<
65 ::std::_Tree_const_iterator<::std::_Tree_val<::std::_Tree_simple_types<::BlockQueuedNamedTickEvent>>>>;
66
67 using PositionEventsMap = ::std::unordered_map<
69 ::std::vector<
70 ::std::_Tree_const_iterator<::std::_Tree_val<::std::_Tree_simple_types<::BlockQueuedNamedTickEvent>>>>>;
71
72public:
73 // member variables
74 // NOLINTBEGIN
75 ::ll::TypedStorage<8, 8, ::LevelChunk*> mOwningChunk;
76 ::ll::TypedStorage<8, 16, ::std::multiset<::BlockQueuedNamedTickEvent, ::BlockNamedTickEventManager::EventCompare>>
77 mQueue;
78 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint, ::std::string>> mNamespaceMap;
79 ::ll::TypedStorage<
80 8,
81 64,
82 ::std::unordered_map<
84 ::std::vector<
85 ::std::_Tree_const_iterator<::std::_Tree_val<::std::_Tree_simple_types<::BlockQueuedNamedTickEvent>>>>>>
86 mPositionEvents;
87 ::ll::TypedStorage<8, 8, ::Tick> mCurrentTick;
88 // NOLINTEND
89
90public:
91 // prevent constructor by default
92 BlockNamedTickEventManager();
93
94public:
95 // member functions
96 // NOLINTBEGIN
97 MCNAPI explicit BlockNamedTickEventManager(::LevelChunk& owningChunk);
98
100 ::ChunkBlockPos const& chunkBlockPos,
101 ::std::_Tree_const_iterator<::std::_Tree_val<::std::_Tree_simple_types<::BlockQueuedNamedTickEvent>>> eventIt
102 );
103
104 MCNAPI ::BlockNamedTickEventManager::Result
105 add(::ChunkBlockPos chunkBlockPos,
106 ::BlockType const& blockType,
107 ::std::string_view nameSpace,
108 ::std::string_view eventName,
109 ::Tick creationTime,
110 ::Tick triggerTime);
111
112 MCNAPI void deserialize(::CompoundTag const& tag, ::BlockTypeRegistry const& registry);
113
114 MCNAPI ::std::vector<::BlockNamedTickEventManager::EventWithDelay>
115 getEventsInArea(::BoundingBox const& boundingBox, ::Tick const& currentTick) const;
116
117 MCNAPI void remove(::ChunkBlockPos const& chunkBlockPos);
118
119 MCNAPI void remove(::brstd::function_ref<bool(::BlockQueuedNamedTickEvent const&)> removeCondition);
120
121 MCNAPI void
122 remove(::ChunkBlockPos const& chunkBlockPos, ::std::string_view nameSpace, ::std::string_view eventName);
123
124 MCNAPI void serialize(::CompoundTag& tag) const;
125
126 MCNAPI ::BlockNamedTickEventManager::Result tick(::BlockSource& region, ::Tick const& until);
127
128 MCNAPI ::std::optional<::BlockQueuedNamedTickEvent>
129 tryGet(::ChunkBlockPos const& chunkBlockPos, ::std::string_view nameSpace, ::std::string_view eventName) const;
130 // NOLINTEND
131
132public:
133 // constructor thunks
134 // NOLINTBEGIN
135 MCNAPI void* $ctor(::LevelChunk& owningChunk);
136 // NOLINTEND
137};
MCAPI void remove(::brstd::function_ref< bool(::BlockQueuedNamedTickEvent const &)> removeCondition)
MCAPI::BlockNamedTickEventManager::Result add(::ChunkBlockPos chunkBlockPos, ::BlockType const &blockType, ::std::string_view nameSpace, ::std::string_view eventName, ::Tick creationTime, ::Tick triggerTime)
MCAPI void remove(::ChunkBlockPos const &chunkBlockPos)
MCAPI void remove(::ChunkBlockPos const &chunkBlockPos, ::std::string_view nameSpace, ::std::string_view eventName)
MCAPI void deserialize(::CompoundTag const &tag, ::BlockTypeRegistry const &registry)
MCAPI void * $ctor(::LevelChunk &owningChunk)
MCAPI void _removeFromPositionIndex(::ChunkBlockPos const &chunkBlockPos, ::std::_Tree_const_iterator<::std::_Tree_val<::std::_Tree_simple_types<::BlockQueuedNamedTickEvent > > > eventIt)
MCAPI::BlockNamedTickEventManager::Result tick(::BlockSource &region, ::Tick const &until)
MCAPI BlockNamedTickEventManager(::LevelChunk &owningChunk)
MCAPI void serialize(::CompoundTag &tag) const
MCAPI ::std::optional<::BlockQueuedNamedTickEvent > tryGet(::ChunkBlockPos const &chunkBlockPos, ::std::string_view nameSpace, ::std::string_view eventName) const
MCAPI ::std::vector<::BlockNamedTickEventManager::EventWithDelay > getEventsInArea(::BoundingBox const &boundingBox, ::Tick const &currentTick) const
Definition BlockQueuedNamedTickEvent.h:15
Definition BlockSource.h:72
Definition BlockTypeRegistry.h:23
Definition BlockType.h:79
Definition BoundingBox.h:13
Definition ChunkBlockPos.h:10
Definition CompoundTag.h:18
Definition LevelChunk.h:76
Definition function_ref.h:60
Definition BlockNamedTickEventManager.h:40
Definition BlockNamedTickEventManager.h:42
Definition Tick.h:5
Definition Alias.h:14