LeviLamina
Loading...
Searching...
No Matches
SpawnMobEvent.h
1
#pragma once
2
3
#include "ll/api/event/Cancellable.h"
4
#include "ll/api/event/world/WorldEvent.h"
5
6
#include "mc/deps/core/math/Vec3.h"
7
#include "mc/world/actor/ActorDefinitionIdentifier.h"
8
#include "mc/world/actor/Mob.h"
9
#include "mc/world/item/ItemStack.h"
10
11
namespace
ll::event::inline world {
12
13
class
SpawnMobEvent
:
public
WorldEvent
{
14
protected
:
15
ActorDefinitionIdentifier
const
& mIdentifier;
16
optional_ref<Actor>
mSpawner;
17
Vec3
const
& mPos;
18
bool
& mNaturalSpawn;
19
bool
& mSurface;
20
bool
& mFromSpawner;
21
22
constexpr
explicit
SpawnMobEvent
(
23
BlockSource
& blockSource,
24
ActorDefinitionIdentifier
const
& identifier,
25
optional_ref<Actor>
spawner,
26
Vec3
const
& pos,
27
bool
& naturalSpawn,
28
bool
& surface,
29
bool
& fromSpawner
30
)
31
:
WorldEvent
(blockSource),
32
mIdentifier(identifier),
33
mSpawner(spawner),
34
mPos(pos),
35
mNaturalSpawn(naturalSpawn),
36
mSurface(surface),
37
mFromSpawner(fromSpawner) {}
38
39
public
:
40
LLAPI
void
serialize
(
CompoundTag
&)
const override
;
41
42
LLNDAPI
ActorDefinitionIdentifier
const
& identifier()
const
;
43
LLNDAPI
optional_ref<Actor>
spawner()
const
;
44
LLNDAPI
Vec3
const
& pos()
const
;
45
LLNDAPI
bool
const
& naturalSpawn()
const
;
46
LLNDAPI
bool
const
& surface()
const
;
47
LLNDAPI
bool
const
& fromSpawner()
const
;
48
};
49
class
SpawningMobEvent
final :
public
Cancellable<SpawnMobEvent> {
50
public
:
51
constexpr
explicit
SpawningMobEvent
(
52
BlockSource
& blockSource,
53
ActorDefinitionIdentifier
const
& identifier,
54
optional_ref<Actor>
spawner,
55
Vec3
const
& pos,
56
bool
& naturalSpawn,
57
bool
& surface,
58
bool
& fromSpawner
59
)
60
: Cancellable(blockSource, identifier, spawner, pos, naturalSpawn, surface, fromSpawner) {}
61
62
public
:
63
LLAPI
void
deserialize(
CompoundTag
const
&)
override
;
64
65
LLNDAPI
bool
& naturalSpawn()
const
;
66
LLNDAPI
bool
& surface()
const
;
67
LLNDAPI
bool
& fromSpawner()
const
;
68
};
69
class
SpawnedMobEvent
final :
public
SpawnMobEvent
{
70
optional_ref<Mob>
mMob;
71
72
public
:
73
constexpr
explicit
SpawnedMobEvent
(
74
optional_ref<Mob>
mob,
75
BlockSource
& blockSource,
76
ActorDefinitionIdentifier
const
& identifier,
77
optional_ref<Actor>
spawner,
78
Vec3
const
& pos,
79
bool
& naturalSpawn,
80
bool
& surface,
81
bool
& fromSpawner
82
)
83
:
SpawnMobEvent
(blockSource, identifier, spawner, pos, naturalSpawn, surface, fromSpawner),
84
mMob(mob) {}
85
86
public
:
87
LLAPI
void
serialize
(
CompoundTag
&)
const override
;
88
89
LLNDAPI
optional_ref<Mob>
mob()
const
;
90
};
91
}
// namespace ll::event::inline world
BlockSource
Definition
BlockSource.h:67
CompoundTag
Definition
CompoundTag.h:13
Vec3
Definition
Vec3.h:10
optional_ref
Definition
optional_ref.h:10
world::SpawnMobEvent
Definition
SpawnMobEvent.h:13
world::SpawnedMobEvent
Definition
SpawnMobEvent.h:69
world::SpawningMobEvent
Definition
SpawnMobEvent.h:49
world::WorldEvent
Definition
WorldEvent.h:9
ActorDefinitionIdentifier
Definition
ActorDefinitionIdentifier.h:13
serialize
Definition
serialize.h:11
src
ll
api
event
world
SpawnMobEvent.h
Generated on Sat Apr 26 2025 05:55:20 for LeviLamina by
1.12.0