Skip to content

Commit de21675

Browse files
committed
fix: fix #201
1 parent bb4e588 commit de21675

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

src/lse/events/EventHooks.cpp

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -263,26 +263,19 @@ LL_TYPE_INSTANCE_HOOK(
263263
ItemStack const& newItem
264264
) {
265265
IF_LISTENED(EVENT_TYPES::onContainerChange) {
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()) {
276-
if (!CallEvent(
277-
EVENT_TYPES::onContainerChange,
278-
PlayerClass::newPlayer(player),
279-
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player->getDimensionId()),
280-
Number::newNumber(slotNumber + this->_getContainerOffset()),
281-
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
282-
ItemClass::newItem(&const_cast<ItemStack&>(newItem))
283-
)) {
284-
return;
285-
}
266+
if (*reinterpret_cast<void***>(this) != LevelContainerModel::$vftable())
267+
return origin(slotNumber, oldItem, newItem);
268+
269+
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;
286279
}
287280
}
288281
IF_LISTENED_END(EVENT_TYPES::onContainerChange);

0 commit comments

Comments
 (0)