use of riskyken.armourersWorkshop.common.inventory.slot.SlotHidable in project Armourers-Workshop by RiskyKen.
the class GuiMannequinTabInventory method initGui.
@Override
public void initGui(int xPos, int yPos, int width, int height) {
super.initGui(xPos, yPos, width, height);
GuiContainer guiCon = (GuiContainer) parent;
// Move player inventory slots.
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(x);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition((int) ((this.width / 2F) - (176F / 2F) + x * INV_SLOT_SIZE + INV_PLAYER_LEFT_PAD), this.height + 1 - 1 - INV_SLOT_SIZE);
}
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(x + y * 9 + 9);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition((int) ((this.width / 2F) - (176F / 2F) + x * INV_SLOT_SIZE + 8), this.height + 1 - 72 - 5 + y * INV_SLOT_SIZE);
}
}
}
// Move mannequin inventory slots.
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 7; i++) {
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(36 + i + j * 7);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition(this.width / 2 - INV_MAN_TAR_WIDTH / 2 + INV_MAN_LEFT_PAD + i * INV_SLOT_SIZE, INV_MAN_TOP_PAD + j * 18);
}
}
}
}
use of riskyken.armourersWorkshop.common.inventory.slot.SlotHidable in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibrary method setSlotVisibility.
public void setSlotVisibility(boolean visible) {
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) inventorySlots.inventorySlots.get(x);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setVisible(visible);
}
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) inventorySlots.inventorySlots.get(x + y * 9 + 9);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setVisible(visible);
}
}
}
Slot slot = getInputSlot();
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setVisible(visible);
}
slot = getOutputSlot();
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setVisible(visible);
}
}
use of riskyken.armourersWorkshop.common.inventory.slot.SlotHidable in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelUpload method update.
@Override
public void update() {
super.update();
buttonUpload.enabled = false;
if (!StringUtils.isNullOrEmpty(textName.getText())) {
SlotHidable slot = ((GuiGlobalLibrary) parent).getInputSlot();
if (SkinNBTHelper.stackHasSkinData(slot.getStack())) {
buttonUpload.enabled = true;
}
}
if (taskSkinUpload != null && taskSkinUpload.isDone()) {
try {
JsonObject json = taskSkinUpload.get();
taskSkinUpload = null;
if (json != null) {
if (json.has("valid") & json.has("action")) {
String action = json.get("action").getAsString();
boolean valid = json.get("valid").getAsBoolean();
if (valid & action.equals("skin-upload")) {
((GuiGlobalLibrary) parent).panelHome.updateSkinPanels();
((GuiGlobalLibrary) parent).switchScreen(Screen.HOME);
}
} else {
if (json.has("reason")) {
String reason = json.get("reason").getAsString();
error = reason;
}
}
} else {
// TODO handle upload failure
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
}
use of riskyken.armourersWorkshop.common.inventory.slot.SlotHidable in project Armourers-Workshop by RiskyKen.
the class GuiHologramProjectorTabInventory method initGui.
@Override
public void initGui(int xPos, int yPos, int width, int height) {
super.initGui(xPos, yPos, width, height);
GuiContainer guiCon = (GuiContainer) parent;
// Move player inventory slots.
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(x);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition((int) ((this.width / 2F) - (176F / 2F) + x * INV_SLOT_SIZE + INV_PLAYER_LEFT_PAD), this.height + 1 - 1 - INV_SLOT_SIZE);
}
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(x + y * 9 + 9);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition((int) ((this.width / 2F) - (176F / 2F) + x * INV_SLOT_SIZE + 8), this.height + 1 - 72 - 5 + y * INV_SLOT_SIZE);
}
}
}
Slot slot = (Slot) guiCon.inventorySlots.inventorySlots.get(36);
if (slot instanceof SlotHidable) {
((SlotHidable) slot).setDisplayPosition((int) ((this.width / 2F) - (16F / 2F)), 16);
}
}
Aggregations