From 7f76d0181137ab5e0c55f67ba081457fd7070a51 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+techlord22@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:21:04 -0400 Subject: [PATCH] tooltip improvements and cleanup --- .../api/capability/IPropertyFluidFilter.java | 29 +++++-------------- .../pipenet/physical/block/PipeBlock.java | 2 +- .../gregtech/api/items/metaitem/MetaItem.java | 2 +- .../materials/FirstDegreeMaterials.java | 18 ++++++------ .../storage/MetaTileEntityDrum.java | 16 ++++------ .../properties/MaterialEnergyProperties.java | 8 +++-- .../properties/MaterialFluidProperties.java | 5 ++-- .../properties/MaterialItemProperties.java | 2 +- .../resources/assets/gregtech/lang/en_us.lang | 9 +++--- .../resources/assets/gregtech/lang/ja_jp.lang | 2 +- .../resources/assets/gregtech/lang/ru_ru.lang | 2 +- .../resources/assets/gregtech/lang/zh_cn.lang | 2 +- 12 files changed, 40 insertions(+), 57 deletions(-) diff --git a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java index 2f1ad999eaf..17a671b58ad 100644 --- a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java @@ -3,7 +3,6 @@ import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; -import gregtech.client.utils.TooltipHelper; import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.Fluid; @@ -70,27 +69,15 @@ default int getPriority() { /** * Append tooltips about containment info * - * @param tooltip the tooltip to append to - * @param showToolsInfo if the "hold shift" line should mention tool info - * @param showTemperatureInfo if the temperature information should be displayed + * @param tooltip the tooltip to append to */ - default void appendTooltips(@NotNull List tooltip, boolean showToolsInfo, boolean showTemperatureInfo) { - if (TooltipHelper.isShiftDown()) { - if (showTemperatureInfo) { - tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); - tooltip.add(I18n.format("gregtech.fluid_pipe.min_temperature", getMinFluidTemperature())); - } - if (isGasProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.gas_proof")); - else tooltip.add(I18n.format("gregtech.fluid_pipe.not_gas_proof")); - if (isPlasmaProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.plasma_proof")); - getContainedAttributes().forEach(a -> a.appendContainerTooltips(tooltip)); - } else if (isGasProof() || isPlasmaProof() || !getContainedAttributes().isEmpty()) { - if (showToolsInfo) { - tooltip.add(I18n.format("gregtech.tooltip.tool_fluid_hold_shift")); - } else { - tooltip.add(I18n.format("gregtech.tooltip.fluid_pipe_hold_shift")); - } - } + default void appendTooltips(@NotNull List tooltip) { + tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); + tooltip.add(I18n.format("gregtech.fluid_pipe.min_temperature", getMinFluidTemperature())); + if (isGasProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.gas_proof")); + else tooltip.add(I18n.format("gregtech.fluid_pipe.not_gas_proof")); + if (isPlasmaProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.plasma_proof")); + getContainedAttributes().forEach(a -> a.appendContainerTooltips(tooltip)); } /** diff --git a/src/main/java/gregtech/api/graphnet/pipenet/physical/block/PipeBlock.java b/src/main/java/gregtech/api/graphnet/pipenet/physical/block/PipeBlock.java index ae89c270dbf..b66bd683e1b 100644 --- a/src/main/java/gregtech/api/graphnet/pipenet/physical/block/PipeBlock.java +++ b/src/main/java/gregtech/api/graphnet/pipenet/physical/block/PipeBlock.java @@ -386,11 +386,11 @@ public static Collection getNodesForTile(PipeTileEntity tile) @Override public void addInformation(@NotNull ItemStack stack, World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + getHandler(stack).addInformation(stack, worldIn, tooltip, flagIn, getStructure()); if (getStructure() instanceof IPipeChanneledStructure channeledStructure) { if (channeledStructure.getChannelCount() > 1) tooltip.add(I18n.format("gregtech.pipe.channels", channeledStructure.getChannelCount())); } - getHandler(stack).addInformation(stack, worldIn, tooltip, flagIn, getStructure()); if (TooltipHelper.isShiftDown()) { tooltip.add(I18n.format(getConnectLangKey())); tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java index a17559b05b2..12a715fd7e2 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java @@ -641,7 +641,7 @@ public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn if (fluidHandler instanceof IFilteredFluidContainer filtered && filtered.getFilter() instanceof IPropertyFluidFilter propertyFilter) { - propertyFilter.appendTooltips(lines, false, true); + propertyFilter.appendTooltips(lines); } } diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index f457551a10e..614f772b8ff 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -1341,7 +1341,7 @@ public static void register() { .color(0xE1B454).iconSet(METALLIC) .flags(DECOMPOSITION_BY_ELECTROLYZING) .components(Manganese, 1, Phosphorus, 1) - .cableProperties(GTValues.V[GTValues.LV], 2, GTValues.V[GTValues.ULV], 500) + .cableProperties(GTValues.V[GTValues.LV], 2, GTValues.V[GTValues.ULV], Integer.MAX_VALUE) .blast(1200, GasTier.LOW) .build(); @@ -1351,7 +1351,7 @@ public static void register() { .color(0x331900).iconSet(METALLIC) .flags(DECOMPOSITION_BY_ELECTROLYZING) .components(Magnesium, 1, Boron, 2) - .cableProperties(GTValues.V[GTValues.MV], 4, GTValues.V[GTValues.LV], 500) + .cableProperties(GTValues.V[GTValues.MV], 4, GTValues.V[GTValues.LV], Integer.MAX_VALUE) .blast(b -> b .temp(2500, GasTier.LOW) .blastStats(VA[HV], 1000) @@ -1364,7 +1364,7 @@ public static void register() { .color(0x555555).iconSet(SHINY) .flags(DECOMPOSITION_BY_ELECTROLYZING) .components(Mercury, 1, Barium, 2, Calcium, 2, Copper, 3, Oxygen, 8) - .cableProperties(GTValues.V[GTValues.HV], 4, GTValues.V[GTValues.MV], 500) + .cableProperties(GTValues.V[GTValues.HV], 4, GTValues.V[GTValues.MV], Integer.MAX_VALUE) .blast(b -> b .temp(3300, GasTier.LOW) .blastStats(VA[HV], 1500) @@ -1377,7 +1377,7 @@ public static void register() { .color(0x008700).iconSet(SHINY) .flags(DECOMPOSITION_BY_CENTRIFUGING) .components(Uranium, 1, Platinum, 3) - .cableProperties(GTValues.V[GTValues.EV], 6, GTValues.V[GTValues.HV], 500) + .cableProperties(GTValues.V[GTValues.EV], 6, GTValues.V[GTValues.HV], Integer.MAX_VALUE) .blast(b -> b .temp(4400, GasTier.MID) .blastStats(VA[EV], 1000) @@ -1390,7 +1390,7 @@ public static void register() { .color(0x330033).iconSet(SHINY) .flags(DECOMPOSITION_BY_CENTRIFUGING) .components(Samarium, 1, Iron, 1, Arsenic, 1, Oxygen, 1) - .cableProperties(GTValues.V[GTValues.IV], 6, GTValues.V[GTValues.EV], 500) + .cableProperties(GTValues.V[GTValues.IV], 6, GTValues.V[GTValues.EV], Integer.MAX_VALUE) .blast(b -> b .temp(5200, GasTier.MID) .blastStats(VA[EV], 1500) @@ -1403,7 +1403,7 @@ public static void register() { .color(0x994C00).iconSet(METALLIC) .flags(DECOMPOSITION_BY_ELECTROLYZING, GENERATE_FINE_WIRE) .components(Indium, 4, Tin, 2, Barium, 2, Titanium, 1, Copper, 7, Oxygen, 14) - .cableProperties(GTValues.V[GTValues.LuV], 8, GTValues.V[GTValues.IV], 500) + .cableProperties(GTValues.V[GTValues.LuV], 8, GTValues.V[GTValues.IV], Integer.MAX_VALUE) .blast(b -> b .temp(6000, GasTier.HIGH) .blastStats(VA[IV], 1000) @@ -1416,7 +1416,7 @@ public static void register() { .color(0x0A0A0A) .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) .components(Uranium, 1, Rhodium, 1, Naquadah, 2) - .cableProperties(GTValues.V[GTValues.ZPM], 8, GTValues.V[LuV], 500) + .cableProperties(GTValues.V[GTValues.ZPM], 8, GTValues.V[LuV], Integer.MAX_VALUE) .blast(b -> b .temp(9000, GasTier.HIGH) .blastStats(VA[IV], 1500) @@ -1430,7 +1430,7 @@ public static void register() { .color(0x7D9673).iconSet(METALLIC) .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) .components(NaquadahEnriched, 4, Trinium, 3, Europium, 2, Duranium, 1) - .cableProperties(GTValues.V[GTValues.UV], 16, GTValues.V[GTValues.ZPM], 500) + .cableProperties(GTValues.V[GTValues.UV], 16, GTValues.V[GTValues.ZPM], Integer.MAX_VALUE) .blast(b -> b .temp(9900, GasTier.HIGH) .blastStats(VA[LuV], 1200) @@ -1444,7 +1444,7 @@ public static void register() { .color(0xFFFFFF).iconSet(BRIGHT) .flags(DECOMPOSITION_BY_ELECTROLYZING) .components(Ruthenium, 1, Trinium, 2, Americium, 1, Neutronium, 2, Oxygen, 8) - .cableProperties(GTValues.V[GTValues.UHV], 24, GTValues.V[GTValues.UV], 500) + .cableProperties(GTValues.V[GTValues.UHV], 24, GTValues.V[GTValues.UV], Integer.MAX_VALUE) .blast(b -> b .temp(10800, GasTier.HIGHER) .blastStats(VA[ZPM], 1000) diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java index e5c5ec252ad..431fbb81347 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java @@ -11,7 +11,6 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; -import gregtech.client.utils.TooltipHelper; import gregtech.common.pipelike.handlers.properties.MaterialFluidProperties; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -278,13 +277,7 @@ public int getDefaultPaintingColor() { @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", tankSize)); - this.fluidFilter.appendTooltips(tooltip, true, true); - - if (TooltipHelper.isShiftDown()) { - tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); - tooltip.add(I18n.format("gregtech.tool_action.screwdriver.auto_output_down")); - tooltip.add(I18n.format("gregtech.tool_action.crowbar")); - } + this.fluidFilter.appendTooltips(tooltip); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null && tagCompound.hasKey("Fluid", Constants.NBT.TAG_COMPOUND)) { @@ -295,10 +288,11 @@ public void addInformation(ItemStack stack, @Nullable World player, List } } - // Override this so that we can control the "Hold SHIFT" tooltip manually @Override - public boolean showToolUsages() { - return false; + public void addToolUsages(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); + tooltip.add(I18n.format("gregtech.tool_action.screwdriver.auto_output_down")); + tooltip.add(I18n.format("gregtech.tool_action.crowbar")); } @Override diff --git a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialEnergyProperties.java b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialEnergyProperties.java index bf2b3825119..9b20e0e3960 100644 --- a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialEnergyProperties.java +++ b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialEnergyProperties.java @@ -116,9 +116,13 @@ public void addInformation(@NotNull ItemStack stack, World worldIn, @NotNull Lis tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier])); tooltip.add(I18n.format("gregtech.cable.voltage", voltageLimit, GTValues.VNF[tier])); tooltip.add(I18n.format("gregtech.cable.amperage", getAmperage(structure))); - tooltip.add(I18n.format("gregtech.cable.loss_per_block", getLoss(structure))); - if (isSuperconductor()) + + long loss = isSuperconductor() && superconductorCriticalTemperature == Integer.MAX_VALUE ? 0 : + getLoss(structure); + tooltip.add(I18n.format("gregtech.cable.loss_per_block", loss)); + if (isSuperconductor() && superconductorCriticalTemperature != Integer.MAX_VALUE) { tooltip.add(I18n.format("gregtech.cable.superconductor_loss", superconductorCriticalTemperature)); + } } @Override diff --git a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialFluidProperties.java b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialFluidProperties.java index 91c99c55a6b..c71d820b373 100644 --- a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialFluidProperties.java +++ b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialFluidProperties.java @@ -152,10 +152,9 @@ public void addInformation(@NotNull ItemStack stack, World worldIn, @NotNull Lis @NotNull ITooltipFlag flagIn, IPipeMaterialStructure structure) { tooltip.add(I18n.format("gregtech.fluid_pipe")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_transfer_rate", getThroughput(structure))); - tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); - tooltip.add(I18n.format("gregtech.fluid_pipe.min_temperature", getMinFluidTemperature())); - tooltip.add(I18n.format("gregtech.fluid_pipe.priority", + tooltip.add(I18n.format("gregtech.pipe.priority", TextFormattingUtil.formatNumbers(getFlowPriority(structure)))); + appendTooltips(tooltip); } @Override diff --git a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialItemProperties.java b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialItemProperties.java index d301ae68e71..f9d0dac25b7 100644 --- a/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialItemProperties.java +++ b/src/main/java/gregtech/common/pipelike/handlers/properties/MaterialItemProperties.java @@ -58,7 +58,7 @@ public void addInformation(@NotNull ItemStack stack, World worldIn, @NotNull Lis tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate_stacks", baseItemsPer5Ticks / 16)); } - tooltip.add(I18n.format("gregtech.item_pipe.priority", + tooltip.add(I18n.format("gregtech.pipe.priority", TextFormattingUtil.formatNumbers(getFlowPriority(structure)))); } diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 58eb43fdd99..2ba1def719c 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -5589,12 +5589,13 @@ gregtech.item_filter.footer=§eClick with item to override gregtech.cable.voltage=§aMax Voltage: §f%,d §f(%s§f) gregtech.cable.amperage=§eMax Amperage: §f%,d gregtech.cable.loss_per_block=§cLoss/Meter/Ampere: §f%,d§f EU-Volt -gregtech.cable.superconductor_loss=§cLoss is set to §f0§c under critical temperature §f%,d§f K +gregtech.cable.superconductor_loss=§cLoss is §f0§c under critical temperature §f%,d§f K gregtech.cable.superconductor=§d%s Superconductor -gregtech.fluid_pipe.max_temperature=§cTemperature Limit: §f%,d K -gregtech.fluid_pipe.min_temperature=§6Can handle fluids at or above §f%,d K +gregtech.fluid_pipe.max_temperature=§cMax Temperature: §f%,d K +gregtech.fluid_pipe.min_temperature=§bMin Temperature: §f%,d K gregtech.pipe.channels=§eChannels: §f%d +gregtech.pipe.priority=§9Priority: §f%s gregtech.fluid_pipe.gas_proof=§6Can handle Gases gregtech.fluid_pipe.acid_proof=§6Can handle Acids gregtech.fluid_pipe.plasma_proof=§6Can handle all Plasmas @@ -5602,8 +5603,6 @@ gregtech.fluid_pipe.not_gas_proof=§4Gases may leak! gregtech.fluid_pipe=§dFluid Pipe gregtech.item_pipe=§dItem Pipe -gregtech.fluid_pipe.priority=§9Priority: §f%s -gregtech.item_pipe.priority=§9Priority: §f%s gregtech.multiblock.work_paused=Work Paused. gregtech.multiblock.running=Running perfectly. diff --git a/src/main/resources/assets/gregtech/lang/ja_jp.lang b/src/main/resources/assets/gregtech/lang/ja_jp.lang index e4024638d3f..f2031f3ea7b 100644 --- a/src/main/resources/assets/gregtech/lang/ja_jp.lang +++ b/src/main/resources/assets/gregtech/lang/ja_jp.lang @@ -5505,7 +5505,7 @@ gregtech.fluid_pipe.cryo_proof=§6極低温の液体を運搬可能 gregtech.fluid_pipe.plasma_proof=§6全てのプラズマを運搬可能 gregtech.fluid_pipe.not_gas_proof=§4気体を密封できない! -gregtech.item_pipe.priority=§9優先度: %d +gregtech.pipe.priority=§9優先度: %d gregtech.multiblock.work_paused=一時停止中 gregtech.multiblock.running=完璧に動作中 diff --git a/src/main/resources/assets/gregtech/lang/ru_ru.lang b/src/main/resources/assets/gregtech/lang/ru_ru.lang index f8bfe1a7604..1a6d1cc4cb1 100644 --- a/src/main/resources/assets/gregtech/lang/ru_ru.lang +++ b/src/main/resources/assets/gregtech/lang/ru_ru.lang @@ -4910,7 +4910,7 @@ gregtech.fluid_pipe.gas_proof=§6Может хранить газы gregtech.fluid_pipe.acid_proof=§6Может хранить кислоты gregtech.fluid_pipe.cryo_proof=§6Может хранить криогенику gregtech.fluid_pipe.not_gas_proof=§4Возможна утечка газов! -gregtech.item_pipe.priority=§9Приоритет: §f%,d +gregtech.pipe.priority=§9Приоритет: §f%,d gregtech.multiblock.work_paused=Работа приостановлена. gregtech.multiblock.running=Работает отлично. gregtech.multiblock.idling=Холостой ход. diff --git a/src/main/resources/assets/gregtech/lang/zh_cn.lang b/src/main/resources/assets/gregtech/lang/zh_cn.lang index fb68f3d3bf2..8f5418c7ff7 100644 --- a/src/main/resources/assets/gregtech/lang/zh_cn.lang +++ b/src/main/resources/assets/gregtech/lang/zh_cn.lang @@ -5577,7 +5577,7 @@ gregtech.fluid_pipe.cryo_proof=§6可传输低温物质 gregtech.fluid_pipe.plasma_proof=§6可传输所有等离子体 gregtech.fluid_pipe.not_gas_proof=§4气体可能泄漏! -gregtech.item_pipe.priority=§9优先级:§f%,d +gregtech.pipe.priority=§9优先级:§f%,d gregtech.multiblock.work_paused=暂停。 gregtech.multiblock.running=运行正常。