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);
}
}
}
}
}
}
Aggregations