LeviLamina
Loading...
Searching...
No Matches
ContainerComponent.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/shared_types/legacy/ContainerType.h"
7#include "mc/world/ContainerCloseListener.h"
8#include "mc/world/ContainerContentChangeListener.h"
9#include "mc/world/inventory/FillingContainer.h"
10
11// auto generated forward declare list
12// clang-format off
13class Actor;
14class BlockSource;
15class CompoundTag;
16class DataLoadHelper;
17class ItemActor;
18class ItemStack;
19class Level;
20class Player;
21class Vec3;
23struct DimensionType;
24// clang-format on
25
26class ContainerComponent : public ::ContainerContentChangeListener, public ::ContainerCloseListener {
27public:
28 // member variables
29 // NOLINTBEGIN
30 ::ll::TypedStorage<8, 440, ::FillingContainer> mContainer;
31 ::ll::TypedStorage<8, 8, ::Actor*> mListenerShim;
32 ::ll::TypedStorage<1, 1, bool> mCanBeSiphonedFrom;
33 ::ll::TypedStorage<1, 1, bool> mPrivate;
34 ::ll::TypedStorage<1, 1, bool> mRestrictToOwner;
35 ::ll::TypedStorage<8, 32, ::std::string> mLootTable;
36 ::ll::TypedStorage<4, 4, int> mLootTableSeed;
37 // NOLINTEND
38
39public:
40 // prevent constructor by default
41 ContainerComponent& operator=(ContainerComponent const&);
42 ContainerComponent(ContainerComponent const&);
43
44public:
45 // virtual functions
46 // NOLINTBEGIN
47 virtual void containerContentChanged(int iSlot) /*override*/;
48
49 virtual void containerClosed(::Actor& actor) /*override*/;
50 // NOLINTEND
51
52public:
53 // member functions
54 // NOLINTBEGIN
55 MCAPI ContainerComponent();
56
57 MCAPI ContainerComponent(::ContainerComponent&& other);
58
59 MCFOLD ::FillingContainer* _getRawContainerPtr();
60
61 MCAPI bool _tryMoveInItem(::ItemStack& item, int slot, int face, int itemCount);
62
63 MCAPI void addAdditionalSaveData(::CompoundTag& tag) const;
64
65 MCAPI bool addItem(::ItemActor& entity);
66
67 MCAPI bool addItem(::ItemStack& item);
68
69 MCAPI bool addItem(::ItemStack& item, int face, int itemCount);
70
71 MCAPI bool canBeSiphonedFrom() const;
72
73 MCAPI bool canOpenContainer(::Actor const& containerActor, ::Player& player) const;
74
75 MCAPI int countItemsOfType(::ItemStack const& item) const;
76
77 MCAPI void dropContents(::BlockSource& region, ::Vec3 const& pos, bool randomizeDrop);
78
79 MCAPI void dropSlotContent(::BlockSource& region, ::Vec3 const& pos, bool randomizeDrop, int slot);
80
81 MCAPI int findFirstSlotForItem(::ItemStack const& item) const;
82
83 MCAPI int getContainerSize() const;
84
85 MCAPI int getEmptySlotsCount() const;
86
87 MCAPI ::ItemStack const& getItem(int slot) const;
88
89 MCAPI ::std::vector<::ItemStack const*> const getSlots() const;
90
91 MCAPI bool hasRoomForItem(::ItemActor const& entity) const;
92
93 MCAPI bool hasRoomForItem(::ItemStack const& item) const;
94
95 MCAPI void initFromDefinition(::Actor& actor);
96
97 MCAPI void initFromDefinition(::Actor& actor, ::ContainerDescription const& desc);
98
99 MCAPI bool isEmpty() const;
100
101 MCAPI bool isPrivate() const;
102
103 MCAPI bool openContainer(::Actor& containerActor, ::Player& player);
104
105 MCAPI ::ContainerComponent& operator=(::ContainerComponent&& other);
106
107 MCAPI void readAdditionalSaveData(::Actor&, ::CompoundTag const& tag, ::DataLoadHelper&);
108
109 MCAPI void rebuildContainer(
110 ::Actor& owner,
111 ::SharedTypes::Legacy::ContainerType type,
112 int size,
113 bool canBesiphonedFrom,
114 int isPrivate,
115 bool
116 );
117
118 MCAPI void removeItem(int slot, int count);
119
120 MCAPI void removeItemsOfType(::ItemStack const& item, int count);
121
122 MCAPI void
123 serverInitItemStackIds(int containerSlot, int count, ::std::function<void(int, ::ItemStack const&)> onNetIdChanged);
124
125 MCAPI void setCustomName(::std::string const& name);
126
127 MCAPI bool setItem(int slot, ::ItemStack const& item);
128
129 MCAPI void setLootTable(::std::string const& lootTable, int lootTableSeed);
130
131 MCAPI void unpackLootTable(::Level& level, ::DimensionType dimensionId);
132 // NOLINTEND
133
134public:
135 // constructor thunks
136 // NOLINTBEGIN
137 MCAPI void* $ctor();
138
139 MCAPI void* $ctor(::ContainerComponent&& other);
140 // NOLINTEND
141
142public:
143 // virtual function thunks
144 // NOLINTBEGIN
145 MCAPI void $containerContentChanged(int iSlot);
146
147 MCAPI void $containerClosed(::Actor& actor);
148
149
150 // NOLINTEND
151
152public:
153 // vftables
154 // NOLINTBEGIN
156
157 MCNAPI static void** $vftableForContainerCloseListener();
158 // NOLINTEND
159};
Definition Actor.h:125
Definition BlockSource.h:73
Definition CompoundTag.h:23
Definition ContainerCloseListener.h:10
static MCAPI void ** $vftableForContainerContentChangeListener()
static MCAPI void ** $vftableForContainerCloseListener()
Definition ContainerContentChangeListener.h:5
Definition DataLoadHelper.h:20
Definition ItemActor.h:31
Definition ItemStack.h:35
Definition Level.h:255
Definition Player.h:137
Definition Vec3.h:10
Definition ContainerDescription.h:14
Definition DimensionType.h:5