use of net.darkhax.botanypots.crop.CropInfo in project AgriCraft by AgriCraft.
the class BotanyPotsHandler method onLookUp.
// Stats and seed conversion
@SubscribeEvent
@SuppressWarnings("unused")
public void onLookUp(LookupEvent.Crop event) {
if (event.getCurrentLookup() instanceof AgriCropInfo) {
event.setLookup(((AgriCropInfo) event.getCurrentLookup()).withStats(event.getItemStack()));
} else {
if (!AgriCraft.instance.getConfig().overrideVanillaFarming()) {
return;
}
if (VanillaSeedConversionHandler.getInstance().isException(event.getItemStack())) {
return;
}
AgriApi.getGenomeAdapterizer().valueOf(event.getItemStack()).ifPresent(genome -> {
ItemStack seedStack = genome.toSeedStack();
CropInfo info = BotanyPotHelper.getCropForItem(seedStack);
if (info instanceof AgriCropInfo) {
event.setLookup(((AgriCropInfo) info).withStats(seedStack));
AgriCraft.instance.queueTask(() -> event.getBotanyPot().setCrop(info, seedStack));
}
});
}
}
Aggregations