Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 public void addInformation(ItemStack stack, EntityPlayer player, List lore, boolean idk) {
   ItemUtils.checkCompound(stack);
   if (getFocus(stack) != null) {
     String[] array = getFocus(stack).getLore(stack);
     for (String s : array) lore.add(LocalizationUtils.translateLocalWithColours(s, s));
   }
 }
Ejemplo n.º 2
0
  public void onUpdate(ItemStack item, World world, Entity heldEnt, int meta, boolean held) {
    ItemUtils.checkCompound(item);

    if (!item.stackTagCompound.hasKey("colourData")) {
      NBTTagCompound colours = new NBTTagCompound();
      colours.setFloat("r", 0.8F);
      colours.setFloat("g", 0.0F);
      colours.setFloat("b", 0.8F);
    }

    float rgb[] = null;

    NBTTagCompound colours = item.stackTagCompound.getCompoundTag("colourData");

    if (item.stackTagCompound.hasKey("focus")) {
      ISceptreFocus focus = getFocus(item);

      if (focus != null) {
        focus.onItemTick(item);
        rgb = focus.getRGB();
      } else item.stackTagCompound.removeTag("focus");
    }

    if (rgb == null) rgb = new float[] {0.8F, 0F, 0.8F};

    float oR = colours.getFloat("r");
    float oG = colours.getFloat("g");
    float oB = colours.getFloat("b");

    if (oR > rgb[0] + step) oR -= step;
    else if (oR < rgb[0] - step) oR += step;
    if (oG > rgb[1] + step) oG -= step;
    else if (oG < rgb[1] - step) oG += step;
    if (oB > rgb[2] + step) oB -= step;
    else if (oB < rgb[2] - step) oB += step;

    colours.setFloat("r", oR);
    colours.setFloat("g", oG);
    colours.setFloat("b", oB);

    item.stackTagCompound.setTag("colourData", colours);
  }