Search in sources :

Example 1 with ContainerBuilder

use of buildcraft.builders.gui.ContainerBuilder in project BuildCraft by BuildCraft.

the class BuilderTooltipHandler method itemTooltipEvent.

@SubscribeEvent
public void itemTooltipEvent(ItemTooltipEvent event) {
    EntityPlayer player = event.getEntityPlayer();
    if (event.getItemStack() != null && player != null && player.openContainer != null && player.openContainer instanceof ContainerBuilder) {
        ContainerBuilder containerBuilder = (ContainerBuilder) player.openContainer;
        TileBuilder builder = containerBuilder.getBuilder();
        if (builder != null) {
            List<RequirementItemStack> needs = builder.getNeededItems();
            if (needs != null) {
                for (RequirementItemStack ris : needs) {
                    if (ris.stack == event.getItemStack()) {
                        event.getToolTip().add(TextFormatting.GRAY + "" + TextFormatting.ITALIC + "Needed: " + ris.size);
                    }
                }
            }
        }
    }
}
Also used : ContainerBuilder(buildcraft.builders.gui.ContainerBuilder) RequirementItemStack(buildcraft.core.blueprints.RequirementItemStack) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

ContainerBuilder (buildcraft.builders.gui.ContainerBuilder)1 RequirementItemStack (buildcraft.core.blueprints.RequirementItemStack)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1