Skip to content

Commit bb4e588

Browse files
committed
refactor: ignore bundle in onContainerChange to solve #201
1 parent 05e192f commit bb4e588

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/lse/events/EventHooks.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,20 @@ LL_TYPE_INSTANCE_HOOK(
263263
ItemStack const& newItem
264264
) {
265265
IF_LISTENED(EVENT_TYPES::onContainerChange) {
266-
Player& player = mUnk84d147.as<Player&>();
267-
if (player.hasOpenContainer()) {
266+
if (this->getContainerSize() == 64) { // Skipping bundle, bundle's container size is 64
267+
Container* container = this->_getContainer();
268+
if (container) {
269+
if (container->getContainerType() == ContainerType::Container) {
270+
return origin(slotNumber, oldItem, newItem);
271+
}
272+
}
273+
}
274+
Player* player = mUnk84d147.as<Player*>();
275+
if (player && player->hasOpenContainer()) {
268276
if (!CallEvent(
269277
EVENT_TYPES::onContainerChange,
270-
PlayerClass::newPlayer(&player),
271-
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player.getDimensionId()),
278+
PlayerClass::newPlayer(player),
279+
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player->getDimensionId()),
272280
Number::newNumber(slotNumber + this->_getContainerOffset()),
273281
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
274282
ItemClass::newItem(&const_cast<ItemStack&>(newItem))

0 commit comments

Comments
 (0)