use of mcp.mobius.waila.api.IDataAccessor in project AgriCraft by AgriCraft.
the class AgriWailaCropBlockInfoProvider method appendBody.
@Override
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
AgriApi.getCrop(accessor.getWorld(), accessor.getPosition()).ifPresent(crop -> {
PlayerEntity player = accessor.getPlayer();
// Add data including full genome if in creative mode
if (player.getHeldItemMainhand().getItem() == AgriCraft.instance.getModItemRegistry().debugger) {
crop.addDisplayInfo(tooltip::add);
tooltip.add(AgriToolTips.GENOME);
crop.getGenome().map(genome -> {
genome.addDisplayInfo(tooltip::add);
return true;
}).orElseGet(() -> {
tooltip.add(AgriToolTips.UNKNOWN);
return false;
});
} else {
// add crop data
if (this.shouldAddInfo(player)) {
crop.addDisplayInfo(tooltip::add);
}
}
});
AgriApi.getSoil(accessor.getWorld(), accessor.getPosition()).ifPresent(soil -> soil.addDisplayInfo(tooltip::add));
}
Aggregations