use of com.infinityraider.agricraft.items.ItemJournal in project AgriCraft by AgriCraft.
the class TileEntitySeedAnalyzer method analyze.
/**
* Analyzes the current SEED.
*
* Marked for cleanup.
*/
public void analyze() {
//analyze the SEED
final Optional<AgriSeed> wrapper = AgriApi.getSeedRegistry().valueOf(specimen);
if (wrapper.isPresent()) {
AgriSeed seed = wrapper.get();
seed = seed.withStat(seed.getStat().withAnalyzed(true));
seed.getStat().writeToNBT(StackHelper.getTag(specimen));
if (this.hasJournal()) {
((ItemJournal) journal.getItem()).addEntry(journal, seed.getPlant());
}
}
}
use of com.infinityraider.agricraft.items.ItemJournal in project AgriCraft by AgriCraft.
the class RecipeCopyJournal method matches.
@Override
public boolean matches(InventoryCrafting invCrafting, World world) {
boolean foundJournal = false;
boolean foundBook = false;
for (int i = 0; i < invCrafting.getSizeInventory(); i++) {
ItemStack stackAtIndex = invCrafting.getStackInSlot(i);
if (stackAtIndex != null && stackAtIndex.getItem() != null) {
if (stackAtIndex.getItem() instanceof ItemJournal) {
if (!foundJournal) {
foundJournal = true;
} else {
// Scandalous!
return false;
}
} else if (stackAtIndex.getItem() == Items.WRITABLE_BOOK) {
if (!foundBook) {
foundBook = true;
} else {
// There can only be one true king!
return false;
}
}
}
}
return foundJournal && foundBook;
}
Aggregations