Skip to content

Commit ff9d21b

Browse files
committed
fix: add missing condition for onContainerChange
1 parent 783fc2c commit ff9d21b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/lse/events/EventHooks.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,17 @@ LL_TYPE_INSTANCE_HOOK(
267267
return origin(slotNumber, oldItem, newItem);
268268

269269
Player& player = mUnk84d147.as<Player&>();
270-
if (!CallEvent(
271-
EVENT_TYPES::onContainerChange,
272-
PlayerClass::newPlayer(&player),
273-
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player.getDimensionId()),
274-
Number::newNumber(slotNumber + this->_getContainerOffset()),
275-
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
276-
ItemClass::newItem(&const_cast<ItemStack&>(newItem))
277-
)) {
278-
return;
270+
if (player.hasOpenContainer()) {
271+
if (!CallEvent(
272+
EVENT_TYPES::onContainerChange,
273+
PlayerClass::newPlayer(&player),
274+
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player.getDimensionId()),
275+
Number::newNumber(slotNumber + this->_getContainerOffset()),
276+
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
277+
ItemClass::newItem(&const_cast<ItemStack&>(newItem))
278+
)) {
279+
return;
280+
}
279281
}
280282
}
281283
IF_LISTENED_END(EVENT_TYPES::onContainerChange);

0 commit comments

Comments
 (0)