mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-04 15:15:11 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../Player/Player.h"
|
||||
#include "../Headers/net.minecraft.world.inventory.ContainerListener.h"
|
||||
using net_minecraft_world_inventory::ContainerListener;
|
||||
@@ -11,78 +10,88 @@ class Item;
|
||||
class ItemInstance;
|
||||
class Container;
|
||||
|
||||
class AbstractContainerMenu
|
||||
{
|
||||
class AbstractContainerMenu {
|
||||
public:
|
||||
static const int CLICKED_OUTSIDE = -999;
|
||||
static const int CLICKED_OUTSIDE = -999;
|
||||
|
||||
static const int CLICK_PICKUP = 0;
|
||||
static const int CLICK_QUICK_MOVE = 1;
|
||||
static const int CLICK_SWAP = 2;
|
||||
static const int CLICK_CLONE = 3;
|
||||
static const int CLICK_PICKUP = 0;
|
||||
static const int CLICK_QUICK_MOVE = 1;
|
||||
static const int CLICK_SWAP = 2;
|
||||
static const int CLICK_CLONE = 3;
|
||||
|
||||
// 4J Stu - Added these to fix problem with items picked up while in the creative menu replacing slots in the creative menu
|
||||
static const int CONTAINER_ID_CARRIED = -1;
|
||||
static const int CONTAINER_ID_INVENTORY = 0;
|
||||
static const int CONTAINER_ID_CREATIVE = -2;
|
||||
// 4J Stu - Added these to fix problem with items picked up while in the
|
||||
// creative menu replacing slots in the creative menu
|
||||
static const int CONTAINER_ID_CARRIED = -1;
|
||||
static const int CONTAINER_ID_INVENTORY = 0;
|
||||
static const int CONTAINER_ID_CREATIVE = -2;
|
||||
|
||||
std::vector<std::shared_ptr<ItemInstance> > *lastSlots;
|
||||
std::vector<Slot *> *slots;
|
||||
int containerId;
|
||||
std::vector<std::shared_ptr<ItemInstance> >* lastSlots;
|
||||
std::vector<Slot*>* slots;
|
||||
int containerId;
|
||||
|
||||
private:
|
||||
short changeUid;
|
||||
bool m_bNeedsRendered; // 4J added
|
||||
short changeUid;
|
||||
bool m_bNeedsRendered; // 4J added
|
||||
|
||||
protected:
|
||||
std::vector<ContainerListener *> *containerListeners;
|
||||
std::vector<ContainerListener*>* containerListeners;
|
||||
|
||||
// 4J Stu - The java does not have ctor here (being an abstract) but we need one to initialise the member variables
|
||||
// TODO Make sure all derived classes also call this
|
||||
AbstractContainerMenu();
|
||||
// 4J Stu - The java does not have ctor here (being an abstract) but we need
|
||||
// one to initialise the member variables
|
||||
// TODO Make sure all derived classes also call this
|
||||
AbstractContainerMenu();
|
||||
|
||||
Slot *addSlot(Slot *slot);
|
||||
Slot* addSlot(Slot* slot);
|
||||
|
||||
public:
|
||||
virtual ~AbstractContainerMenu();
|
||||
virtual void addSlotListener(ContainerListener *listener);
|
||||
std::vector<std::shared_ptr<ItemInstance> > *getItems();
|
||||
void sendData(int id, int value);
|
||||
virtual void broadcastChanges();
|
||||
virtual bool needsRendered();
|
||||
virtual bool clickMenuButton(std::shared_ptr<Player> player, int buttonId);
|
||||
Slot *getSlotFor(std::shared_ptr<Container> c, int index);
|
||||
Slot *getSlot(int index);
|
||||
virtual std::shared_ptr<ItemInstance> quickMoveStack(std::shared_ptr<Player> player, int slotIndex);
|
||||
virtual std::shared_ptr<ItemInstance> clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player);
|
||||
virtual bool mayCombine(Slot *slot, std::shared_ptr<ItemInstance> item);
|
||||
virtual ~AbstractContainerMenu();
|
||||
virtual void addSlotListener(ContainerListener* listener);
|
||||
std::vector<std::shared_ptr<ItemInstance> >* getItems();
|
||||
void sendData(int id, int value);
|
||||
virtual void broadcastChanges();
|
||||
virtual bool needsRendered();
|
||||
virtual bool clickMenuButton(std::shared_ptr<Player> player, int buttonId);
|
||||
Slot* getSlotFor(std::shared_ptr<Container> c, int index);
|
||||
Slot* getSlot(int index);
|
||||
virtual std::shared_ptr<ItemInstance> quickMoveStack(
|
||||
std::shared_ptr<Player> player, int slotIndex);
|
||||
virtual std::shared_ptr<ItemInstance> clicked(
|
||||
int slotIndex, int buttonNum, int clickType,
|
||||
std::shared_ptr<Player> player);
|
||||
virtual bool mayCombine(Slot* slot, std::shared_ptr<ItemInstance> item);
|
||||
|
||||
protected:
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player);
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld,
|
||||
std::shared_ptr<Player> player);
|
||||
|
||||
public:
|
||||
virtual void removed(std::shared_ptr<Player> player);
|
||||
virtual void slotsChanged();// 4J used to take a std::shared_ptr<Container> container but wasn't using it, so removed to simplify things
|
||||
bool isPauseScreen();
|
||||
void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
|
||||
void setAll(ItemInstanceArray *items);
|
||||
virtual void setData(int id, int value);
|
||||
short backup(std::shared_ptr<Inventory> inventory);
|
||||
virtual void removed(std::shared_ptr<Player> player);
|
||||
virtual void
|
||||
slotsChanged(); // 4J used to take a std::shared_ptr<Container> container
|
||||
// but wasn't using it, so removed to simplify things
|
||||
bool isPauseScreen();
|
||||
void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
|
||||
void setAll(ItemInstanceArray* items);
|
||||
virtual void setData(int id, int value);
|
||||
short backup(std::shared_ptr<Inventory> inventory);
|
||||
|
||||
private:
|
||||
std::unordered_set<std::shared_ptr<Player> , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers;
|
||||
std::unordered_set<std::shared_ptr<Player>, PlayerKeyHash, PlayerKeyEq>
|
||||
unSynchedPlayers;
|
||||
|
||||
public:
|
||||
bool isSynched(std::shared_ptr<Player> player);
|
||||
void setSynched(std::shared_ptr<Player> player, bool synched);
|
||||
virtual bool stillValid(std::shared_ptr<Player> player) = 0;
|
||||
|
||||
// 4J Stu Added for UI
|
||||
unsigned int getSize() { return (unsigned int)slots->size(); }
|
||||
bool isSynched(std::shared_ptr<Player> player);
|
||||
void setSynched(std::shared_ptr<Player> player, bool synched);
|
||||
virtual bool stillValid(std::shared_ptr<Player> player) = 0;
|
||||
|
||||
// 4J Stu Added for UI
|
||||
unsigned int getSize() { return (unsigned int)slots->size(); }
|
||||
|
||||
protected:
|
||||
// 4J Stu - Changes to return bool brought forward from 1.2
|
||||
bool moveItemStackTo(std::shared_ptr<ItemInstance> itemStack, int startSlot, int endSlot, bool backwards);
|
||||
// 4J Stu - Changes to return bool brought forward from 1.2
|
||||
bool moveItemStackTo(std::shared_ptr<ItemInstance> itemStack, int startSlot,
|
||||
int endSlot, bool backwards);
|
||||
|
||||
public:
|
||||
virtual bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||
virtual bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user