use of com.infinityraider.agricraft.api.v1.plant.IAgriPlant in project AgriCraft by AgriCraft.
the class AgriWailaCropBlockInfoProvider method getStack.
@Override
public ItemStack getStack(IDataAccessor accessor, IPluginConfig config) {
if (accessor.getBlock() instanceof BlockCropPlant) {
TileEntity tile = accessor.getTileEntity();
if (tile instanceof TileEntityCropPlant) {
TileEntityCropPlant crop = (TileEntityCropPlant) tile;
IAgriPlant plant = crop.getPlant();
if (plant.isPlant()) {
return plant.toItemStack();
}
}
}
return ItemStack.EMPTY;
}
use of com.infinityraider.agricraft.api.v1.plant.IAgriPlant in project AgriCraft by AgriCraft.
the class TileEntitySeedAnalyzer method addSeedToJournal.
public static Optional<ItemStack> addSeedToJournal(ItemStack seed, ItemStack journal) {
// Check if the items are a seed and a journal respectively
if (!seed.isEmpty() && !journal.isEmpty() && seed.getItem() instanceof IAgriGeneCarrierItem && journal.getItem() instanceof IAgriJournalItem) {
// Fetch plant from seed
IAgriJournalItem journalItem = (IAgriJournalItem) journal.getItem();
IAgriPlant plant = ((IAgriGeneCarrierItem) seed.getItem()).getPlant(seed);
// If the plant is not yet discovered, add it to the journal
if (!journalItem.isPlantDiscovered(journal, plant)) {
ItemStack newJournal = journal.copy();
journalItem.addEntry(newJournal, plant);
return Optional.of(newJournal);
}
}
return Optional.empty();
}
use of com.infinityraider.agricraft.api.v1.plant.IAgriPlant in project AgriCraft by AgriCraft.
the class TileEntitySeedAnalyzer method addDebugInfo.
protected void addDebugInfo(Consumer<String> consumer) {
ItemStack journalStack = this.getJournal();
if (journalStack.isEmpty() || !(journalStack.getItem() instanceof IAgriJournalItem)) {
consumer.accept("No journal present");
} else {
IAgriJournalItem journalItem = (IAgriJournalItem) journalStack.getItem();
consumer.accept("Journal (" + journalItem.getDiscoveredSeeds(journalStack).size() + " plants):");
for (IAgriPlant plant : journalItem.getDiscoveredSeeds(journalStack)) {
consumer.accept(" - " + plant.getId());
}
}
}
use of com.infinityraider.agricraft.api.v1.plant.IAgriPlant in project AgriCraft by AgriCraft.
the class TileEntityCropBase method addServerDebugInfo.
@Override
public void addServerDebugInfo(@Nonnull Consumer<String> consumer) {
Preconditions.checkNotNull(consumer);
consumer.accept("CROP:");
if (this.hasCropSticks()) {
consumer.accept(" - Crop Sticks Present");
}
if (this.isCrossCrop()) {
consumer.accept(" - This is a cross crop");
} else {
final IAgriPlant plant = this.getPlant();
final IAgriWeed weed = this.getWeeds();
final IAgriStatsMap stats = this.getStats();
if (plant.isPlant()) {
consumer.accept(" - This crop has a plant");
}
if (weed.isWeed()) {
consumer.accept(" - This crop has weeds");
}
consumer.accept(" - Plant Id: " + plant.getId());
consumer.accept(" - Plant Stage: " + this.getGrowthStage());
consumer.accept(" - Plant Stages: " + plant.getGrowthStages());
consumer.accept(" - Weed Id: " + weed.getId());
consumer.accept(" - Weed Stage: " + this.getWeedGrowthStage());
consumer.accept(" - Weed Stages: " + weed.getGrowthStages());
consumer.accept(" - stats: " + stats);
consumer.accept(" - Fertile: " + this.isFertile());
consumer.accept(" - Mature: " + this.isMature());
consumer.accept(" - Fully Grown: " + this.isFullyGrown());
consumer.accept(" - AgriSoil: " + this.getSoil());
}
}
Aggregations