mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-05-25 22:44:48 +00:00
fix: beacon menu item consumption, data sync, and button state issues
- Prevent payment item from being consumed when submitting unchanged powers - Reorder ServerPlayer::openBeacon to send ContainerOpenPacket before addSlotListener so beacon data packets arrive after the client menu is ready - Add BeaconMenu::broadcastChanges() to continuously sync levels and powers to clients, matching the pattern FurnaceMenu already uses - Initialize UIControl_BeaconEffectButton::m_lastState to prevent stale heap memory from suppressing Iggy ChangeState calls on menu re-entry
This commit is contained in:
@@ -2132,12 +2132,21 @@ void PlayerConnection::handleCustomPayload(shared_ptr<CustomPayloadPacket> custo
|
||||
|
||||
BeaconMenu *beaconMenu = static_cast<BeaconMenu *>(player->containerMenu);
|
||||
Slot *slot = beaconMenu->getSlot(0);
|
||||
if (slot->hasItem())
|
||||
if (slot != nullptr && slot->hasItem())
|
||||
{
|
||||
slot->remove(1);
|
||||
shared_ptr<BeaconTileEntity> beacon = beaconMenu->getBeacon();
|
||||
int prevPrimary = beacon->getPrimaryPower();
|
||||
int prevSecondary = beacon->getSecondaryPower();
|
||||
|
||||
beacon->setPrimaryPower(primary);
|
||||
beacon->setSecondaryPower(secondary);
|
||||
|
||||
// Only consume the payment item if the powers actually changed
|
||||
if (beacon->getPrimaryPower() != prevPrimary || beacon->getSecondaryPower() != prevSecondary)
|
||||
{
|
||||
slot->remove(1);
|
||||
}
|
||||
|
||||
beacon->setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user