use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class MultiblockInfoRecipeWrapper method getTooltipStrings.
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
if (tooltipBlockStack != null && !tooltipBlockStack.isEmpty() && !Mouse.isButtonDown(0)) {
Minecraft minecraft = Minecraft.getMinecraft();
ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL;
List<String> tooltip = tooltipBlockStack.getTooltip(minecraft.player, flag);
EnumRarity rarity = tooltipBlockStack.getRarity();
for (int k = 0; k < tooltip.size(); ++k) {
if (k == 0) {
tooltip.set(k, rarity.color + tooltip.get(k));
} else {
tooltip.set(k, TextFormatting.GRAY + tooltip.get(k));
}
}
Map<ItemStack, List<ITextComponent>> blockTooltipMap = infoPage.getBlockTooltipMap();
if (blockTooltipMap.containsKey(tooltipBlockStack)) {
List<ITextComponent> tooltips = blockTooltipMap.get(tooltipBlockStack);
for (int i = 0; i < tooltips.size(); i++) {
// Start at i+1 due to ItemStack name
tooltip.add(i + 1, tooltips.get(i).getFormattedText());
}
}
return tooltip;
}
return Collections.emptyList();
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class ElectricBlastFurnaceInfo method generateBlockTooltips.
@Override
protected void generateBlockTooltips() {
super.generateBlockTooltips();
ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 10).setStyle(new Style().setColor(TextFormatting.AQUA));
addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF), tooltip);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class MultiSmelterInfo method generateBlockTooltips.
@Override
protected void generateBlockTooltips() {
super.generateBlockTooltips();
ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 9).setStyle(new Style().setColor(TextFormatting.AQUA));
addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF), tooltip);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class ImplosionCompressorInfo method generateBlockTooltips.
@Override
protected void generateBlockTooltips() {
super.generateBlockTooltips();
ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 14).setStyle(new Style().setColor(TextFormatting.AQUA));
addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID), tooltip);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class ScannerBehavior method onItemUsingTick.
@Override
public void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {
if (!player.world.isRemote) {
Pair<String, Integer> pair = checkCanUseScanner(stack, player, true);
String failureReason = pair.getLeft();
if (failureReason == null) {
ITextComponent component = new TextComponentTranslation("behavior.scanner.analyzing");
component.getStyle().setColor(TextFormatting.GREEN);
player.sendStatusMessage(component, true);
int maxUseCount = pair.getRight();
if ((getMaxItemUseDuration(stack) - count) >= maxUseCount) {
player.activeItemStackUseCount = 0;
}
} else {
ITextComponent component = new TextComponentTranslation(failureReason);
component.getStyle().setColor(TextFormatting.RED);
player.sendStatusMessage(component, true);
player.stopActiveHand();
player.getCooldownTracker().setCooldown(stack.getItem(), 20);
}
}
}
Aggregations