Examples of IIndividual


Examples of forestry.api.genetics.IIndividual

  @Override
  public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
    if(!itemstack.hasTagCompound())
      return;

    IIndividual individual = getIndividual(itemstack);

    if(individual.isAnalyzed()) {
      if(Proxies.common.isShiftDown())
        individual.addTooltip(list);
      else
        list.add("\u00A7o<" + StringUtil.localize("gui.tooltip.tmi") + ">");
    } else
      list.add("<" + StringUtil.localize("gui.unknown") + ">");
  }
View Full Code Here

Examples of forestry.api.genetics.IIndividual

  protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    super.drawGuiContainerBackgroundLayer(f, i, j);
    String header = StringUtil.localize("gui.page") + " " + (pageCurrent + 1) + "/" + pageMax;
    fontRendererObj.drawString(header, guiLeft + 95 + getCenteredOffset(header, 98), guiTop + 10, fontColor.get("gui.title"));

    IIndividual individual = getIndividualAtPosition(i, j);
    if (individual == null)
      displayBreedingStatistics(10);

    if (individual != null) {
      RenderHelper.enableGUIStandardItemLighting();
      startPage();

      displaySpeciesInformation(true, individual.getGenome().getPrimary(), iconStacks.get(individual.getIdent()), 10);
      if (!individual.isPureBred(0))
        displaySpeciesInformation(individual.isAnalyzed(), individual.getGenome().getSecondary(), iconStacks.get(individual.getGenome().getSecondary().getUID()),
            10);

      endPage();
    }
  }
View Full Code Here

Examples of forestry.api.genetics.IIndividual

  public void processTurnResult(GameProfile gameProfile) {
    if(!game.isWon())
      return;

    IIndividual individual = AlleleManager.alleleRegistry.getIndividual(inventory.getStackInSlot(SLOT_ANALYZE));
    if(individual == null)
      return;

    for(ItemStack itemstack : individual.getGenome().getPrimary().getResearchBounty(worldObj, gameProfile, individual, game.getBountyLevel()))
      inventory.addStack(itemstack, SLOT_RESULTS_1, SLOTS_RESULTS_COUNT, false, true);
  }
View Full Code Here

Examples of forestry.api.genetics.IIndividual

      IPollinatable pitcher = (IPollinatable) tile;
      if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), pitcher))
        continue;

      IIndividual pollen = pitcher.getPollen();

      if (pollen != null)
        return pollen;
    }
View Full Code Here

Examples of forestry.api.genetics.IIndividual

    for (int i = 0; i < invInput.getSizeInventory(); i++) {
      ItemStack inputStack = invInput.getStackInSlot(i);
      if (inputStack == null || !AlleleManager.alleleRegistry.isIndividual(inputStack))
        continue;
      // Analyzed bees in the input buffer are added to the output queue.
      IIndividual individual = AlleleManager.alleleRegistry.getIndividual(inputStack);
      if (individual.isAnalyzed()) {
        pendingProducts.push(inputStack);
        invInput.decrStackSize(i, inputStack.stackSize);
      }
    }
View Full Code Here

Examples of forestry.api.genetics.IIndividual

        setErrorState(EnumErrorCode.OK);
        return true;
      }

      // Analyzation is done.
      IIndividual individual = AlleleManager.alleleRegistry.getIndividual(stackToAnalyze);
      // No bee, abort
      if (individual == null)
        return false;

      individual.analyze();
      NBTTagCompound nbttagcompound = new NBTTagCompound();
      individual.writeToNBT(nbttagcompound);
      stackToAnalyze.setTagCompound(nbttagcompound);

      pendingProducts.push(stackToAnalyze);
      setInventorySlotContents(SLOT_ANALYZE, null);
      sendNetworkUpdate();
View Full Code Here

Examples of forestry.api.genetics.IIndividual

    lastUpdate = System.currentTimeMillis();
  }

  /* INTERACTION */
  public void initialize(ItemStack specimen) {
    IIndividual individual = AlleleManager.alleleRegistry.getIndividual(specimen);
    if(individual == null) {
      return;
    }

    int boardSize = individual.getGenome().getPrimary().getComplexity() + individual.getGenome().getSecondary().getComplexity();
    if(boardSize % 2 != 0)
      boardSize = Math.round((float)boardSize / 2) * 2;
    boardSize = boardSize <= 22 ? boardSize >= 6 ? boardSize : 6 : 22;

    isEnded = false;
    bountyLevel = BOUNTY_MAX;
    gameTokens = new GameToken[boardSize];

    ISpeciesRoot root = individual.getGenome().getPrimary().getRoot();
    ArrayList<ItemStack> pairs = new ArrayList<ItemStack>();
    for(int i = 0; i < boardSize / 2; i++) {
      IIndividual token = root.templateAsIndividual(root.getRandomTemplate(rand));
      pairs.add(root.getMemberStack(token, 0));
    }

    boolean first = true;
    for(ItemStack pair : pairs) {
View Full Code Here

Examples of forestry.api.genetics.IIndividual

  public void probe(ItemStack specimen, IInventory inventory, int startSlot, int slotCount) {
    if(gameTokens == null)
      return;
    if(isEnded)
      return;
    IIndividual individual = AlleleManager.alleleRegistry.getIndividual(specimen);
    if(individual == null)
      return;

    hideProbedTokens();
    if(bountyLevel > 1)
      bountyLevel--;

    int[] tokenIndices = getUnrevealedTokens(getSampleSize() <= slotCount ? getSampleSize() : slotCount);
    int processedTokens = 0;

    for(int i = 0; i < slotCount; i++) {
      ItemStack sample = inventory.getStackInSlot(startSlot + i);
      if(sample == null || sample.stackSize <= 0)
        continue;

      sample = inventory.decrStackSize(startSlot + i, 1);
      if(rand.nextFloat() >= individual.getGenome().getPrimary().getResearchSuitability(sample)) {
        continue;
      }

      gameTokens[tokenIndices[processedTokens]].isProbed = true;
      gameTokens[tokenIndices[processedTokens]].isRevealed = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.