Beispiel #1
0
  @Override
  @SideOnly(Side.CLIENT)
  public void registerIcons(IconRegister iconRegister) {

    for (IAction action : ActionManager.actions.values()) {
      action.registerIcons(iconRegister);
    }

    for (ITrigger trigger : ActionManager.triggers.values()) {
      trigger.registerIcons(iconRegister);
    }

    icons = new Icon[ItemGate.MAX];
    icons[ItemGate.Gate] = iconRegister.registerIcon("buildcraft:gate");
    icons[ItemGate.Gate_Iron_And] = iconRegister.registerIcon("buildcraft:gate_iron_and");
    icons[ItemGate.Gate_Iron_Or] = iconRegister.registerIcon("buildcraft:gate_iron_or");
    icons[ItemGate.Gate_Gold_And] = iconRegister.registerIcon("buildcraft:gate_gold_and");
    icons[ItemGate.Gate_Gold_Or] = iconRegister.registerIcon("buildcraft:gate_gold_or");
    icons[ItemGate.Gate_Diamond_And] = iconRegister.registerIcon("buildcraft:gate_diamond_and");
    icons[ItemGate.Gate_Diamond_Or] = iconRegister.registerIcon("buildcraft:gate_diamond_or");

    icons[ItemGate.Autarchic_Gate] = iconRegister.registerIcon("buildcraft:autarchic_gate");
    icons[ItemGate.Autarchic_Gate_Iron_And] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_iron_and");
    icons[ItemGate.Autarchic_Gate_Iron_Or] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_iron_or");
    icons[ItemGate.Autarchic_Gate_Gold_And] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_gold_and");
    icons[ItemGate.Autarchic_Gate_Gold_Or] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_gold_or");
    icons[ItemGate.Autarchic_Gate_Diamond_And] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_diamond_and");
    icons[ItemGate.Autarchic_Gate_Diamond_Or] =
        iconRegister.registerIcon("buildcraft:autarchic_gate_diamond_or");
  }
 public FallbackWrapper(ITrigger wrap) {
   try {
     iconMethod = wrap.getClass().getDeclaredMethod("getTextureIcon");
   } catch (Exception e) {
   }
   try {
     activeMethod =
         wrap.getClass()
             .getDeclaredMethod("isTriggerActive", TileEntity.class, ITriggerParameter.class);
   } catch (Exception e) {
     throw Throwables.propagate(e);
   }
   brokenInstance = wrap;
 }
Beispiel #3
0
 public static void fixTriggers() {
   if (fixedTriggers) return;
   for (int i = 0; i < ActionManager.triggers.length; i++) {
     try {
       ITrigger t = ActionManager.triggers[i];
       t = new FallbackWrapper(t);
       ActionManager.triggers[i] = t;
       BuildCraftCore.bcLog.severe(
           "Trigger " + t.getClass() + " using OLD API found, using a falling back wrapper!");
     } catch (RuntimeException e) {
       // Carry on
     }
   }
   fixedTriggers = true;
 }
  @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();
  }
Beispiel #5
0
  public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
    if (trigger instanceof ITriggerPipe)
      return ((ITriggerPipe) trigger).isTriggerActive(this, parameter);
    else if (trigger != null) {
      for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
        TileEntity tile = container.getTile(o);

        if (tile != null && !(tile instanceof TileGenericPipe)) {
          if (trigger.isTriggerActive(o.getOpposite(), tile, parameter)) return true;
        }
      }
    }

    return false;
  }
 @Override
 public int getTextureIndex() {
   ITrigger trigger = pipe.getTrigger(slot);
   if (trigger != null) return trigger.getIndexInTexture();
   else return 0;
 }
 @Override
 public String getTexture() {
   ITrigger trigger = pipe.getTrigger(slot);
   if (trigger != null) return trigger.getTextureFile();
   else return "";
 }
 @Override
 public String getDescription() {
   ITrigger trigger = pipe.getTrigger(slot);
   if (trigger != null) return trigger.getDescription();
   else return "";
 }
 @Override
 public int hashCode() {
   return brokenInstance.hashCode();
 }
 @Override
 public boolean equals(Object obj) {
   return brokenInstance.equals(obj);
 }
 @Override
 public ITriggerParameter createParameter() {
   return brokenInstance.createParameter();
 }
 @Override
 public String getDescription() {
   return brokenInstance.getDescription();
 }
 @Override
 public boolean hasParameter() {
   return brokenInstance.hasParameter();
 }
 @Override
 @SideOnly(Side.CLIENT)
 public IIconProvider getIconProvider() {
   return brokenInstance.getIconProvider();
 }
 @Override
 public int getId() {
   return brokenInstance.getId();
 }