Exemplo n.º 1
0
    @Override
    public void onTick() {
      // Perform raytrace
      MovingObjectPosition pos = Raytrace.traceLiving(player, DISTANCE);

      boolean good;
      if (pos != null && pos.typeOfHit == MovingObjectType.BLOCK) {
        TileEntity tile = player.worldObj.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
        if (EnergyBlockHelper.isSupported(tile)) {
          good = true;

          // Very well, charge the block
          if (!isRemote) {
            float charge = getChargingSpeed(aData);
            EnergyBlockHelper.charge(tile, charge, true);
          }
        } else {
          good = false;
        }
      } else {
        good = false;
      }

      cpData.perform(0, instance.getConsumption(aData));
      aData.addSkillExp(instance, getExpIncr(aData, good));

      if (isRemote) {
        updateEffects(pos, good);
      }
    }
Exemplo n.º 2
0
    @Override
    public void onStart() {
      aData = AbilityData.get(player);
      cpData = CPData.get(player);

      cpData.perform(instance.getOverload(aData), 0);

      if (isRemote) startEffects();
    }
Exemplo n.º 3
0
    public void updateInfo() {

      Preset p = data.getPreset(id);
      byte[] pdata = (id == active && editor != null) ? editor.display : p.getData();

      for (int i = 0; i < 4; ++i) {
        Category cat = AbilityData.get(player).getCategory();
        Controllable c = cat.getControllable(pdata[i]);
        Widget main = widget.getWidget("" + i);
        DrawTexture.get(main.getWidget("icon")).texture =
            c == null ? Resources.TEX_EMPTY : c.getHintIcon();
        TextBox.get(main.getWidget("text")).content = c == null ? "" : c.getHintText();
      }
    }
Exemplo n.º 4
0
 private static float call(String name, AbilityData data) {
   return instance.getFunc(name).callFloat(data.getSkillExp(instance));
 }
Exemplo n.º 5
0
    public Selector(int _keyid) {
      keyid = _keyid;

      AbilityData aData = AbilityData.get(player);
      Category c = aData.getCategory();

      for (Skill s : aData.getControllableSkillList()) {
        int cid = s.getControlID();
        if (!editor.hasMapping(cid)) {
          available.add(s);
        }
      }

      List<SelectionProvider> providers = new ArrayList();
      providers.add(
          new SelectionProvider(
              -1, Resources.getTexture("guis/preset_settings/cancel"), local("skill_remove")));
      for (Skill s : available)
        providers.add(new SelectionProvider(s.getControlID(), s.getHintIcon(), s.getDisplayName()));

      height = MARGIN * 2 + SIZE + STEP * (ldiv(providers.size(), MAX_PER_ROW) - 1);
      width =
          available.size() < MAX_PER_ROW
              ? MARGIN * 2 + SIZE + STEP * (providers.size() - 1)
              : MARGIN * 2 + SIZE + STEP * (MAX_PER_ROW - 1);

      transform.setSize(width, height);

      // Build the window and the widget
      regEventHandler(
          new FrameEventHandler() {

            @Override
            public void handleEvent(Widget w, FrameEvent event) {
              CRL_WHITE.bind();
              ACRenderingHelper.drawGlow(0, 0, width, height, 1, CRL_WHITE);

              CRL_BACK.bind();
              HudUtils.colorRect(0, 0, width, height);

              String str;
              Widget hovering = foreground.getHoveringWidget();
              if (hovering != null && hovering.getName().contains("_sel")) {
                SelHandler sh = hovering.getComponent("_sel");
                str = sh.selection.hint;
              } else {
                str = local("skill_select");
              }

              double len = Font.font.strLen(str, 9);
              CRL_BACK.bind();
              HudUtils.colorRect(0, -13.5, len + 6, 11.5);
              ACRenderingHelper.drawGlow(0, -13.5, len + 6, 11.5, 1, CRL_GLOW);

              Font.font.draw(str, 3, -12, 9, 0xbbbbbb);

              GL11.glColor4d(1, 1, 1, 1);
            }
          });

      // Build all the skills that can be set
      for (int i = 0; i < providers.size(); ++i) {
        int row = i / MAX_PER_ROW, col = i % MAX_PER_ROW;
        SelectionProvider selection = providers.get(i);
        Widget single = new Widget();
        single.transform.setPos(MARGIN + col * STEP, MARGIN + row * STEP);
        single.transform.setSize(SIZE, SIZE);

        DrawTexture tex = new DrawTexture().setTex(selection.texture);
        single.addComponent(tex);
        single.addComponent(new Tint());
        single.addComponent(new SelHandler(selection));
        addWidget("_sel" + i, single);
      }
    }
 public EntityTPMarking(EntityPlayer player) {
   super(player.worldObj);
   data = AbilityData.get(player);
   this.player = player;
   setPosition(player.posX, player.posY, player.posZ);
 }