mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-09 13:47:14 +00:00
fix(jui): make creative screen correctly override menu clicked()
(also made rendertooltip names in AbstractContainerScreen match so my editor stops complaining)
This commit is contained in:
parent
cd6959b989
commit
ca276943f2
|
|
@ -116,7 +116,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) {
|
|||
// places)
|
||||
void AbstractContainerScreen::renderTooltipInternal(
|
||||
const std::vector<std::wstring>& cleanedLines,
|
||||
const std::vector<int>& lineColors, int mouseX, int mouseY) {
|
||||
const std::vector<int>& lineColors, int xm, int ym) {
|
||||
if (cleanedLines.empty()) return;
|
||||
|
||||
int tooltipWidth = 0;
|
||||
|
|
@ -125,8 +125,8 @@ void AbstractContainerScreen::renderTooltipInternal(
|
|||
if (lineWidth > tooltipWidth) tooltipWidth = lineWidth;
|
||||
}
|
||||
|
||||
int tooltipX = mouseX + 12;
|
||||
int tooltipY = mouseY - 12;
|
||||
int tooltipX = xm + 12;
|
||||
int tooltipY = ym - 12;
|
||||
int tooltipHeight = 8;
|
||||
|
||||
if (cleanedLines.size() > 1) {
|
||||
|
|
@ -175,7 +175,7 @@ void AbstractContainerScreen::renderTooltipInternal(
|
|||
}
|
||||
|
||||
void AbstractContainerScreen::renderTooltip(std::shared_ptr<ItemInstance> item,
|
||||
int mouseX, int mouseY) {
|
||||
int xm, int ym) {
|
||||
if (item == nullptr) return;
|
||||
|
||||
std::vector<std::wstring> elementName;
|
||||
|
|
@ -240,12 +240,12 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr<ItemInstance> item,
|
|||
lineColors[0] = app.GetHTMLColour(item->getRarity()->color);
|
||||
}
|
||||
|
||||
renderTooltipInternal(cleanedLines, lineColors, mouseX, mouseY);
|
||||
renderTooltipInternal(cleanedLines, lineColors, xm, ym);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderTooltip(
|
||||
const std::vector<std::wstring>& lines, int mouseX, int mouseY) {
|
||||
const std::vector<std::wstring>& lines, int xm, int ym) {
|
||||
if (lines.empty()) return;
|
||||
|
||||
std::vector<std::wstring> cleanedLines = lines;
|
||||
|
|
@ -260,12 +260,12 @@ void AbstractContainerScreen::renderTooltip(
|
|||
}
|
||||
}
|
||||
|
||||
renderTooltipInternal(cleanedLines, lineColors, mouseX, mouseY);
|
||||
renderTooltipInternal(cleanedLines, lineColors, xm, ym);
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderTooltip(const std::wstring& line,
|
||||
int mouseX, int mouseY) {
|
||||
renderTooltip(std::vector<std::wstring>{line}, mouseX, mouseY);
|
||||
void AbstractContainerScreen::renderTooltip(const std::wstring& line, int xm,
|
||||
int ym) {
|
||||
renderTooltip(std::vector<std::wstring>{line}, xm, ym);
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderLabels() {}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ protected:
|
|||
// used in other places
|
||||
virtual void renderTooltipInternal(
|
||||
const std::vector<std::wstring>& cleanedLines,
|
||||
const std::vector<int>& lineColors, int mouseX, int mouseY);
|
||||
virtual void renderTooltip(std::shared_ptr<ItemInstance> item, int x,
|
||||
int y);
|
||||
const std::vector<int>& lineColors, int xm, int ym);
|
||||
virtual void renderTooltip(std::shared_ptr<ItemInstance> item, int xm,
|
||||
int ym);
|
||||
|
||||
private:
|
||||
virtual void renderSlot(Slot* slot);
|
||||
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual void tick() override;
|
||||
|
||||
// 4jcraft: 1.6.x era overloads
|
||||
virtual void renderTooltip(const std::vector<std::wstring>& lines, int x,
|
||||
int y);
|
||||
virtual void renderTooltip(const std::wstring& line, int x, int y);
|
||||
virtual void renderTooltip(const std::vector<std::wstring>& lines, int xm,
|
||||
int ym);
|
||||
virtual void renderTooltip(const std::wstring& line, int xm, int ym);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ bool CreativeInventoryScreen::ContainerCreative::stillValid(
|
|||
|
||||
std::shared_ptr<ItemInstance>
|
||||
CreativeInventoryScreen::ContainerCreative::clicked(
|
||||
int slotIndex, int buttonNum, int clickType,
|
||||
std::shared_ptr<Player> player) {
|
||||
int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player,
|
||||
bool looped) {
|
||||
std::shared_ptr<Inventory> inventory = player->inventory;
|
||||
std::shared_ptr<ItemInstance> carried = inventory->getCarried();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ public:
|
|||
std::vector<std::shared_ptr<ItemInstance>> itemList;
|
||||
|
||||
ContainerCreative(std::shared_ptr<Player> player);
|
||||
virtual bool stillValid(std::shared_ptr<Player> player);
|
||||
virtual bool stillValid(std::shared_ptr<Player> player) override;
|
||||
virtual std::shared_ptr<ItemInstance> clicked(
|
||||
int slotIndex, int buttonNum, int clickType,
|
||||
std::shared_ptr<Player> player);
|
||||
std::shared_ptr<Player> player, bool looped = false) override;
|
||||
void scrollTo(float pos);
|
||||
bool canScroll();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue