Skip to content

Commit

Permalink
fix: fix #201
Browse files Browse the repository at this point in the history
  • Loading branch information
Dofes committed Jan 7, 2025
1 parent bb4e588 commit de21675
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions src/lse/events/EventHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,26 +263,19 @@ LL_TYPE_INSTANCE_HOOK(
ItemStack const& newItem
) {
IF_LISTENED(EVENT_TYPES::onContainerChange) {
if (this->getContainerSize() == 64) { // Skipping bundle, bundle's container size is 64
Container* container = this->_getContainer();
if (container) {
if (container->getContainerType() == ContainerType::Container) {
return origin(slotNumber, oldItem, newItem);
}
}
}
Player* player = mUnk84d147.as<Player*>();
if (player && player->hasOpenContainer()) {
if (!CallEvent(
EVENT_TYPES::onContainerChange,
PlayerClass::newPlayer(player),
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player->getDimensionId()),
Number::newNumber(slotNumber + this->_getContainerOffset()),
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
ItemClass::newItem(&const_cast<ItemStack&>(newItem))
)) {
return;
}
if (*reinterpret_cast<void***>(this) != LevelContainerModel::$vftable())
return origin(slotNumber, oldItem, newItem);

Player& player = mUnk84d147.as<Player&>();
if (!CallEvent(
EVENT_TYPES::onContainerChange,
PlayerClass::newPlayer(&player),
BlockClass::newBlock(mUnk74419a.as<BlockPos>(), player.getDimensionId()),
Number::newNumber(slotNumber + this->_getContainerOffset()),
ItemClass::newItem(&const_cast<ItemStack&>(oldItem)),
ItemClass::newItem(&const_cast<ItemStack&>(newItem))
)) {
return;
}
}
IF_LISTENED_END(EVENT_TYPES::onContainerChange);
Expand Down

0 comments on commit de21675

Please sign in to comment.