mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
feat(jui): re-enable and update TrapScreen
(Dispenser and Dropper GUI)
This commit is contained in:
parent
fbbf086f71
commit
975f716f9c
|
|
@ -683,9 +683,13 @@ bool LocalPlayer::openBeacon(std::shared_ptr<BeaconTileEntity> beacon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalPlayer::openTrap(std::shared_ptr<DispenserTileEntity> trap) {
|
bool LocalPlayer::openTrap(std::shared_ptr<DispenserTileEntity> trap) {
|
||||||
|
#ifdef ENABLE_JAVA_GUIS
|
||||||
|
minecraft->setScreen(new TrapScreen(inventory, trap));
|
||||||
|
bool success = true;
|
||||||
|
#else
|
||||||
bool success = app.LoadTrapMenu(GetXboxPad(), inventory, trap);
|
bool success = app.LoadTrapMenu(GetXboxPad(), inventory, trap);
|
||||||
if (success) ui.PlayUISFX(eSFX_Press);
|
if (success) ui.PlayUISFX(eSFX_Press);
|
||||||
// minecraft->setScreen(new TrapScreen(inventory, trap));
|
#endif
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ const wchar_t* Textures::preLoaded[TN_COUNT] = {
|
||||||
L"title/mclogo",
|
L"title/mclogo",
|
||||||
L"gui/horse",
|
L"gui/horse",
|
||||||
L"gui/anvil",
|
L"gui/anvil",
|
||||||
|
L"gui/trap",
|
||||||
L"title/bg/panorama",
|
L"title/bg/panorama",
|
||||||
#endif
|
#endif
|
||||||
// L"item/christmas",
|
// L"item/christmas",
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ typedef enum _TEXTURE_NAME {
|
||||||
TN_TITLE_MCLOGO,
|
TN_TITLE_MCLOGO,
|
||||||
TN_GUI_HORSE,
|
TN_GUI_HORSE,
|
||||||
TN_GUI_ANVIL,
|
TN_GUI_ANVIL,
|
||||||
|
TN_GUI_TRAP,
|
||||||
TN_TITLE_BG_PANORAMA,
|
TN_TITLE_BG_PANORAMA,
|
||||||
#endif
|
#endif
|
||||||
// TN_TILE_XMAS_CHEST,
|
// TN_TILE_XMAS_CHEST,
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,29 @@
|
||||||
#include "../../../Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h"
|
#include "../../../Minecraft.World/Blocks/TileEntities/DispenserTileEntity.h"
|
||||||
#include "../../../Minecraft.World/Headers/net.minecraft.world.h"
|
#include "../../../Minecraft.World/Headers/net.minecraft.world.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_JAVA_GUIS
|
||||||
|
ResourceLocation GUI_TRAP_LOCATION = ResourceLocation(TN_GUI_TRAP);
|
||||||
|
#endif
|
||||||
|
|
||||||
TrapScreen::TrapScreen(std::shared_ptr<Inventory> inventory,
|
TrapScreen::TrapScreen(std::shared_ptr<Inventory> inventory,
|
||||||
std::shared_ptr<DispenserTileEntity> trap)
|
std::shared_ptr<DispenserTileEntity> trap)
|
||||||
: AbstractContainerScreen(new TrapMenu(inventory, trap)) {}
|
: AbstractContainerScreen(new TrapMenu(inventory, trap)) {
|
||||||
|
this->trap = trap;
|
||||||
|
this->inventory = inventory;
|
||||||
|
}
|
||||||
|
|
||||||
void TrapScreen::renderLabels() {
|
void TrapScreen::renderLabels() {
|
||||||
font->draw(L"Dispenser", 16 + 4 + 40, 2 + 2 + 2, 0x404040);
|
font->draw(trap->getName(), 16 + 4 + 40, 2 + 2 + 2, 0x404040);
|
||||||
font->draw(L"Inventory", 8, imageHeight - 96 + 2, 0x404040);
|
font->draw(inventory->getName(), 8, imageHeight - 96 + 2, 0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrapScreen::renderBg(float a) {
|
void TrapScreen::renderBg(float a) {
|
||||||
// 4J Unused
|
// 4J Unused
|
||||||
#if 0
|
#ifdef ENABLE_JAVA_GUIS
|
||||||
int tex = minecraft->textures->loadTexture(L"/gui/trap.png");
|
glColor4f(1, 1, 1, 1);
|
||||||
glColor4f(1, 1, 1, 1);
|
minecraft->textures->bindTexture(&GUI_TRAP_LOCATION);
|
||||||
minecraft->textures->bind(tex);
|
int xo = (width - imageWidth) / 2;
|
||||||
int xo = (width - imageWidth) / 2;
|
int yo = (height - imageHeight) / 2;
|
||||||
int yo = (height - imageHeight) / 2;
|
this->blit(xo, yo, 0, 0, imageWidth, imageHeight);
|
||||||
this->blit(xo, yo, 0, 0, imageWidth, imageHeight);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
#include "AbstractContainerScreen.h"
|
#include "AbstractContainerScreen.h"
|
||||||
class DispenserTileEntity;
|
class DispenserTileEntity;
|
||||||
class Inventory;
|
class Inventory;
|
||||||
|
|
@ -11,4 +12,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void renderLabels();
|
virtual void renderLabels();
|
||||||
virtual void renderBg(float a);
|
virtual void renderBg(float a);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<Inventory> inventory;
|
||||||
|
std::shared_ptr<DispenserTileEntity> trap;
|
||||||
};
|
};
|
||||||
Loading…
Reference in a new issue