Exemplo n.º 1
0
  @Override
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    String name = _container.getGateName();

    fontRenderer.drawString(name, getCenteredOffset(name), 15, 0x404040);
    fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);

    drawForegroundSelection(par1, par2);
  }
Exemplo n.º 2
0
  @Override
  protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    _container.synchronize();
    int texture = 0;

    texture = mc.renderEngine.getTexture(_container.getGateGuiFile());

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(texture);
    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    int triggerTracker = 0;
    for (int s = 0; s < slots.length; ++s) {
      AdvancedSlot slot = slots[s];

      if (slot instanceof TriggerSlot) {
        ITrigger trigger = ((TriggerSlot) slot).getTrigger();

        if (_container.getGateOrdinal() >= GateKind.AND_3.ordinal()) {

          if (_container.triggerState[triggerTracker++]) {
            mc.renderEngine.bindTexture(texture);

            drawTexturedModalRect(cornerX + slot.x + 35, cornerY + slot.y + 6, 176, 18, 18, 4);
          }

          if (trigger == null || !trigger.hasParameter()) {
            mc.renderEngine.bindTexture(texture);

            drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y - 1, 176, 0, 18, 18);
          }
        } else if (_container.triggerState[triggerTracker++]) {
          mc.renderEngine.bindTexture(texture);

          drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y + 6, 176, 18, 18, 4);
        }
      }
    }

    drawBackgroundSlots();
  }
Exemplo n.º 3
0
  @Override
  protected void mouseClicked(int i, int j, int k) {
    super.mouseClicked(i, j, k);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;

    int position = getSlotAtLocation(i - cornerX, j - cornerY);

    AdvancedSlot slot = null;

    if (position < 0) return;

    slot = slots[position];

    if (slot instanceof TriggerSlot && _container.hasTriggers()) {
      TriggerSlot triggerSlot = (TriggerSlot) slot;

      ITrigger changed = null;
      if (triggerSlot.getTrigger() == null) {

        if (k == 0) {
          changed = _container.getFirstTrigger();
        } else {
          changed = _container.getLastTrigger();
        }

      } else {
        Iterator<ITrigger> it = _container.getTriggerIterator(k != 0);

        for (; it.hasNext(); ) {
          ITrigger trigger = it.next();

          if (!it.hasNext()) {
            changed = null;
            break;
          }

          if (trigger == triggerSlot.getTrigger()) {
            changed = it.next();
            break;
          }
        }
      }

      _container.setTrigger(position, changed, true);

      if (_container.getGateOrdinal() >= GateKind.AND_3.ordinal()) {
        _container.setTriggerParameter(position, null, true);
      }
    } else if (slot instanceof ActionSlot) {
      ActionSlot actionSlot = (ActionSlot) slot;

      IAction changed = null;
      if (actionSlot.getAction() == null) {

        if (k == 0) {
          changed = _container.getFirstAction();
        } else {
          changed = _container.getLastAction();
        }

      } else {
        Iterator<IAction> it = _container.getActionIterator(k != 0);

        for (; it.hasNext(); ) {
          IAction action = it.next();

          if (!it.hasNext()) {
            changed = null;
            break;
          }

          if (action == actionSlot.getAction()) {
            changed = it.next();
            break;
          }
        }
      }

      _container.setAction(position - nbEntries, changed, true);
    } else if (slot instanceof TriggerParameterSlot) {
      TriggerSlot trigger = (TriggerSlot) slots[position - nbEntries * 2];

      if (trigger.isDefined() && trigger.getTrigger().hasParameter()) {
        ITriggerParameter param = trigger.getTrigger().createParameter();

        if (param != null) {
          param.set(mc.thePlayer.inventory.getItemStack());
          _container.setTriggerParameter(position - nbEntries * 2, param, true);
        }
      }
    }

    _container.markDirty();
  }