private void tryStartNextResearch(String name) { List<Integer> queue = ResearchTracker.instance().getResearchQueueFor(worldObj, name); if (!queue.isEmpty()) { int goalId = queue.get(0); ResearchGoal goalInstance = ResearchGoal.getGoal(goalId); if (goalInstance == null) { return; } if (goalInstance.tryStart(resourceInventory, -1)) { ResearchTracker.instance().startResearch(worldObj, name, goalId); } else if (useAdjacentInventory) { TileEntity t; boolean started = false; int x = xCoord + inventoryDirection.offsetX; int y = yCoord + inventoryDirection.offsetY; int z = zCoord + inventoryDirection.offsetZ; int side = inventorySide.ordinal(); if ((t = worldObj.getTileEntity(x, y, z)) instanceof IInventory) { started = goalInstance.tryStart((IInventory) t, side); } if (started) { ResearchTracker.instance().startResearch(worldObj, name, goalId); } } } startCheckDelay = startCheckDelayMax; }
private void workTick(String name, int goal, int tickCount) { ResearchGoal g1 = ResearchGoal.getGoal(goal); int progress = ResearchTracker.instance().getProgress(worldObj, name); progress += tickCount; if (progress >= g1.getTotalResearchTime()) { ResearchTracker.instance().finishResearch(worldObj, getCrafterName(), goal); tryStartNextResearch(name); } else { ResearchTracker.instance().setProgress(worldObj, name, progress); } storedEnergy -= AWCoreStatics.energyPerResearchUnit; }
protected final RecipeResearched addResearch(String... names) { ResearchGoal g; for (String name : names) { name = name.startsWith("research.") ? name : "research." + name; g = ResearchGoal.getGoal(name); if (g != null) { neededResearch.add(g.getId()); } else { throw new IllegalArgumentException("COULD NOT LOCATE RESEARCH GOAL FOR NAME: " + name); } } return this; }
protected final RecipeResearched addResearch(int... nums) { ResearchGoal g; for (int k : nums) { g = ResearchGoal.getGoal(k); if (g != null) { neededResearch.add(k); } } return this; }