Search in sources :

Example 1 with IPluginConfig

use of mcp.mobius.waila.api.IPluginConfig 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));
}
Also used : AgriCraft(com.infinityraider.agricraft.AgriCraft) IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) AgriApi(com.infinityraider.agricraft.api.v1.AgriApi) IDataAccessor(mcp.mobius.waila.api.IDataAccessor) PlayerEntity(net.minecraft.entity.player.PlayerEntity) BlockCropPlant(com.infinityraider.agricraft.content.core.BlockCropPlant) TileEntityCropPlant(com.infinityraider.agricraft.content.core.TileEntityCropPlant) ITextComponent(net.minecraft.util.text.ITextComponent) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) AgriToolTips(com.infinityraider.agricraft.reference.AgriToolTips) IComponentProvider(mcp.mobius.waila.api.IComponentProvider) IPluginConfig(mcp.mobius.waila.api.IPluginConfig) TileEntity(net.minecraft.tileentity.TileEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

AgriCraft (com.infinityraider.agricraft.AgriCraft)1 AgriApi (com.infinityraider.agricraft.api.v1.AgriApi)1 IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)1 BlockCropPlant (com.infinityraider.agricraft.content.core.BlockCropPlant)1 TileEntityCropPlant (com.infinityraider.agricraft.content.core.TileEntityCropPlant)1 AgriToolTips (com.infinityraider.agricraft.reference.AgriToolTips)1 List (java.util.List)1 IComponentProvider (mcp.mobius.waila.api.IComponentProvider)1 IDataAccessor (mcp.mobius.waila.api.IDataAccessor)1 IPluginConfig (mcp.mobius.waila.api.IPluginConfig)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ITextComponent (net.minecraft.util.text.ITextComponent)1