mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-07-07 11:18:11 +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:
@@ -39,6 +39,29 @@ void BeaconMenu::addSlotListener(ContainerListener *listener)
|
||||
listener->setContainerData(this, 2, secondaryPower);
|
||||
}
|
||||
|
||||
void BeaconMenu::broadcastChanges()
|
||||
{
|
||||
AbstractContainerMenu::broadcastChanges();
|
||||
|
||||
int currentLevels = beacon->getLevels();
|
||||
int currentPrimary = beacon->getPrimaryPower();
|
||||
int currentSecondary = beacon->getSecondaryPower();
|
||||
|
||||
for (auto& listener : containerListeners)
|
||||
{
|
||||
if (levels != currentLevels)
|
||||
listener->setContainerData(this, 0, currentLevels);
|
||||
if (primaryPower != currentPrimary)
|
||||
listener->setContainerData(this, 1, currentPrimary);
|
||||
if (secondaryPower != currentSecondary)
|
||||
listener->setContainerData(this, 2, currentSecondary);
|
||||
}
|
||||
|
||||
levels = currentLevels;
|
||||
primaryPower = currentPrimary;
|
||||
secondaryPower = currentSecondary;
|
||||
}
|
||||
|
||||
void BeaconMenu::setData(int id, int value)
|
||||
{
|
||||
if (id == 0) beacon->setLevels(value);
|
||||
|
||||
Reference in New Issue
Block a user