Files
BluTac10-Xbox_Neo/Minecraft.World/BeaconMenu.h
itsRevela 9c9df615a1 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
2026-04-09 21:34:48 -05:00

45 lines
1.2 KiB
C++

#pragma once
#include "AbstractContainerMenu.h"
#include "Slot.h"
class BeaconTileEntity;
class BeaconMenu : public AbstractContainerMenu
{
private:
class PaymentSlot : public Slot
{
public:
PaymentSlot(shared_ptr<Container> container, int slot, int x, int y);
bool mayPlace(shared_ptr<ItemInstance> item);
int getMaxStackSize() const;
};
public:
static const int PAYMENT_SLOT = 0;
static const int INV_SLOT_START = PAYMENT_SLOT + 1;
static const int INV_SLOT_END = INV_SLOT_START + 9 * 3;
static const int USE_ROW_SLOT_START = INV_SLOT_END;
static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;
private:
shared_ptr<BeaconTileEntity> beacon;
PaymentSlot *paymentSlot;
// copied values because container/client system is retarded
int levels;
int primaryPower;
int secondaryPower;
public:
BeaconMenu(shared_ptr<Container> inventory, shared_ptr<BeaconTileEntity> beacon);
void addSlotListener(ContainerListener *listener) override;
void broadcastChanges() override;
void setData(int id, int value);
shared_ptr<BeaconTileEntity> getBeacon();
bool stillValid(shared_ptr<Player> player);
shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);
};