|
21 | 21 | import gregtech.api.util.GTUtility; |
22 | 22 | import gregtech.api.util.KeyUtil; |
23 | 23 | import gregtech.api.util.RelativeDirection; |
24 | | -import gregtech.api.util.TextComponentUtil; |
25 | 24 | import gregtech.api.util.TextFormattingUtil; |
26 | 25 | import gregtech.client.renderer.ICubeRenderer; |
27 | 26 | import gregtech.client.renderer.texture.Textures; |
@@ -89,12 +88,9 @@ public class MetaTileEntityHPCA extends MultiblockWithDisplayBase |
89 | 88 |
|
90 | 89 | private double temperature = IDLE_TEMPERATURE; // start at idle temperature |
91 | 90 |
|
92 | | - private final gregtech.api.gui.widgets.ProgressWidget.TimedProgressSupplier progressSupplier; |
93 | | - |
94 | 91 | public MetaTileEntityHPCA(ResourceLocation metaTileEntityId) { |
95 | 92 | super(metaTileEntityId); |
96 | 93 | this.energyContainer = new EnergyContainerList(new ArrayList<>()); |
97 | | - this.progressSupplier = new gregtech.api.gui.widgets.ProgressWidget.TimedProgressSupplier(200, 47, false); |
98 | 94 | this.hpcaHandler = new HPCAGridHandler(this); |
99 | 95 | } |
100 | 96 |
|
@@ -369,7 +365,12 @@ protected MultiblockUIFactory createUIFactory() { |
369 | 365 | .minElementMargin(1) |
370 | 366 | .mapTo(3, 9, value -> new DynamicDrawable(() -> hpcaHandler.getComponentTexture2(value)) |
371 | 367 | .asWidget() |
372 | | - // could add tooltips here showing the name of the component |
| 368 | + .tooltipAutoUpdate(true) |
| 369 | + .tooltipBuilder(tooltip -> { |
| 370 | + if (isStructureFormed()) { |
| 371 | + tooltip.addLine(hpcaHandler.getComponentKey(value)); |
| 372 | + } |
| 373 | + }) |
373 | 374 | .size(14)))); |
374 | 375 | } |
375 | 376 |
|
@@ -835,76 +836,6 @@ public int getMaxCoolantDemand() { |
835 | 836 | return maxCoolant; |
836 | 837 | } |
837 | 838 |
|
838 | | - public void addInfo(List<ITextComponent> textList) { |
839 | | - // Max Computation |
840 | | - ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, |
841 | | - Integer.toString(getMaxCWUt())); |
842 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
843 | | - "gregtech.multiblock.hpca.info_max_computation", data)); |
844 | | - |
845 | | - // Cooling |
846 | | - TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : |
847 | | - TextFormatting.GREEN; |
848 | | - data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingDemand())); |
849 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
850 | | - "gregtech.multiblock.hpca.info_max_cooling_demand", data)); |
851 | | - |
852 | | - data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingAmount())); |
853 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
854 | | - "gregtech.multiblock.hpca.info_max_cooling_available", data)); |
855 | | - |
856 | | - // Coolant Required |
857 | | - if (getMaxCoolantDemand() > 0) { |
858 | | - data = TextComponentUtil.stringWithColor( |
859 | | - TextFormatting.YELLOW, |
860 | | - getMaxCoolantDemand() + "L "); |
861 | | - ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, |
862 | | - "gregtech.multiblock.hpca.info_coolant_name"); |
863 | | - data.appendSibling(coolantName); |
864 | | - } else { |
865 | | - data = TextComponentUtil.stringWithColor(TextFormatting.GREEN, "0"); |
866 | | - } |
867 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
868 | | - "gregtech.multiblock.hpca.info_max_coolant_required", data)); |
869 | | - |
870 | | - // Bridging |
871 | | - if (numBridges > 0) { |
872 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, |
873 | | - "gregtech.multiblock.hpca.info_bridging_enabled")); |
874 | | - } else { |
875 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, |
876 | | - "gregtech.multiblock.hpca.info_bridging_disabled")); |
877 | | - } |
878 | | - } |
879 | | - |
880 | | - public void addWarnings(List<ITextComponent> textList) { |
881 | | - List<ITextComponent> warnings = new ArrayList<>(); |
882 | | - if (numBridges > 1) { |
883 | | - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
884 | | - "gregtech.multiblock.hpca.warning_multiple_bridges")); |
885 | | - } |
886 | | - if (computationProviders.isEmpty()) { |
887 | | - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
888 | | - "gregtech.multiblock.hpca.warning_no_computation")); |
889 | | - } |
890 | | - if (getMaxCoolingDemand() > getMaxCoolingAmount()) { |
891 | | - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, |
892 | | - "gregtech.multiblock.hpca.warning_low_cooling")); |
893 | | - } |
894 | | - if (!warnings.isEmpty()) { |
895 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, |
896 | | - "gregtech.multiblock.hpca.warning_structure_header")); |
897 | | - textList.addAll(warnings); |
898 | | - } |
899 | | - } |
900 | | - |
901 | | - public void addErrors(List<ITextComponent> textList) { |
902 | | - if (components.stream().anyMatch(IHPCAComponentHatch::isDamaged)) { |
903 | | - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, |
904 | | - "gregtech.multiblock.hpca.error_damaged")); |
905 | | - } |
906 | | - } |
907 | | - |
908 | 839 | public void addWarnings2(KeyManager keyManager) { |
909 | 840 | List<IKey> warnings = new ArrayList<>(); |
910 | 841 | if (numBridges > 1) { |
@@ -951,6 +882,14 @@ public UITexture getComponentTexture2(int index) { |
951 | 882 | return components.get(index).getComponentIcon2(); |
952 | 883 | } |
953 | 884 |
|
| 885 | + public IKey getComponentKey(int index) { |
| 886 | + if (components.size() <= index) { |
| 887 | + return IKey.EMPTY; |
| 888 | + } |
| 889 | + |
| 890 | + return IKey.lang(components.get(index).getTileName()); |
| 891 | + } |
| 892 | + |
954 | 893 | public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing frontFacing, |
955 | 894 | EnumFacing upwardsFacing, boolean flip) { |
956 | 895 | EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(frontFacing, upwardsFacing, flip); |
|
0 commit comments