Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ dependencies {
modLocalRuntime(forge.jade)
modLocalRuntime(forge.curios)
modLocalRuntime(forge.modernfix)
modLocalRuntime(forge.modernui)
modLocalRuntime(forge.ferritecore)

// AE2 //
Expand Down Expand Up @@ -72,6 +71,7 @@ dependencies {
// Client-only runtime mods //
modClientLocalRuntime(forge.embeddium)
modClientLocalRuntime(forge.oculus)
modClientLocalRuntime(forge.modernui)
renderNurseCfg(libs.renderNurse)

// // Mouse Tweaks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"block.gtmoremachine.wireless_energy_monitor": "ɹoʇıuoW ʎbɹǝuƎ ssǝןǝɹıM",
"item.gtmoremachine.wireless_energy_binding_tool": "ןoo⟘ buıpuıᗺ ʎbɹǝuƎ ssǝןǝɹıM",
"item.gtmoremachine.wireless_energy_terminal": "ןɐuıɯɹǝ⟘ ʎbɹǝuƎ ssǝןǝɹıM",
"itemGroup.gtmoremachine.wireless": "ǝuıɥɔɐWǝɹoW⟘⅁"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"block.gtmoremachine.wireless_energy_monitor": "Wireless Energy Monitor",
"item.gtmoremachine.wireless_energy_binding_tool": "Wireless Energy Binding Tool",
"item.gtmoremachine.wireless_energy_terminal": "Wireless Energy Terminal",
"itemGroup.gtmoremachine.wireless": "GTMoreMachine"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "gtmoremachine:item/wireless_energy_terminal"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cn.qiuye.gtmoremachine.api.misc;

import cn.qiuye.gtmoremachine.api.gui.monitor.Format;
import cn.qiuye.gtmoremachine.utils.FormattingUtil;
import cn.qiuye.gtmoremachine.utils.NumberUtils;
import cn.qiuye.gtmoremachine.utils.TeamUtils;
Expand All @@ -24,13 +25,13 @@ public interface ITransferData {

MetaMachine machine();

default Component getInfo() {
default Component getInfo(Format format) {
MetaMachine machine = machine();
BigInteger eut = Throughput();
String pos = machine.getPos().toShortString();
return Component.translatable(machine.getBlockState().getBlock().getDescriptionId())
.withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("recipe.condition.dimension.tooltip", machine.getLevel().dimension().location()).append(" [").append(pos).append("] ").append(Component.translatable("gtmoremachine.machine.wireless_energy_monitor.tooltip.0", TeamUtils.getName(machine.getLevel(), UUID()))))))
.append((eut.compareTo(BigInteger.ZERO) > 0 ? " +" : " ") + NumberUtils.formatBigIntegerNumberOrSic(eut)).append(" EU/t (").append(FormattingUtil.voltageName(new BigDecimal(eut))).append(")")
.append((eut.compareTo(BigInteger.ZERO) > 0 ? " +" : " ") + NumberUtils.bigIntegerNumberOrSicText(eut, format)).append(" EU/t (").append(FormattingUtil.voltageName(new BigDecimal(eut))).append(")")
.append(ComponentPanelWidget.withButton(Component.literal(" [ ] "), pos));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ default List<Component> getDisplayText(Statistics statistics, Format format, Pow
textListCache.add(Component.translatable("gtmoremachine.machine.wireless_energy_monitor.tooltip.0",
TeamUtils.getName(getLevel(), getUUID())).withStyle(ChatFormatting.AQUA));
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.1",
Component.literal(NumberUtils.formatBigIntegerNumberOrSic(energyTotal))).withStyle(ChatFormatting.GOLD));
Component.literal(NumberUtils.bigIntegerNumberOrSicText(energyTotal, format))).withStyle(ChatFormatting.GOLD));
if (GTMMConfig.INSTANCE.isWirelessRateEnable) {
long rate = container.getRate();
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.2",
Component.literal(NumberUtils.formatBigIntegerNumberOrSic(BigInteger.valueOf(rate))),
Component.literal(NumberUtils.bigIntegerNumberOrSicText(BigInteger.valueOf(rate), format)),
Component.literal(String.valueOf(rate / GTValues.VEX[GTUtil.getFloorTierByVoltage(rate)])),
Component.literal(GTValues.VNF[GTUtil.getFloorTierByVoltage(rate)])).withStyle(ChatFormatting.GRAY));
}
Expand All @@ -49,22 +49,22 @@ default List<Component> getDisplayText(Statistics statistics, Format format, Pow

BigDecimal avgMinute = stat.getMinuteAvg();
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.last_minute",
Component.literal(NumberUtils.formatBigDecimalNumberOrSic(avgMinute)).withStyle(ChatFormatting.DARK_AQUA),
Component.literal(NumberUtils.bigDecimalNumberOrSicText(avgMinute, format)).withStyle(ChatFormatting.DARK_AQUA),
Component.literal(FormattingUtil.voltageAmperage(avgMinute).toEngineeringString()), FormattingUtil.voltageName(avgMinute)));
BigDecimal avgHour = stat.getHourAvg();
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.last_hour",
Component.literal(NumberUtils.formatBigDecimalNumberOrSic(avgHour)).withStyle(ChatFormatting.YELLOW),
Component.literal(NumberUtils.bigDecimalNumberOrSicText(avgHour, format)).withStyle(ChatFormatting.YELLOW),
Component.literal(FormattingUtil.voltageAmperage(avgHour).toEngineeringString()),
FormattingUtil.voltageName(avgHour)));
BigDecimal avgDay = stat.getDayAvg();
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.last_day",
Component.literal(NumberUtils.formatBigDecimalNumberOrSic(avgDay)).withStyle(ChatFormatting.DARK_GREEN),
Component.literal(NumberUtils.bigDecimalNumberOrSicText(avgDay, format)).withStyle(ChatFormatting.DARK_GREEN),
Component.literal(FormattingUtil.voltageAmperage(avgDay).toEngineeringString()),
FormattingUtil.voltageName(avgDay)));
// average useage
BigDecimal avgEnergy = stat.getAvgEnergy();
textListCache.add(FormattingUtil.formatWithConstantWidth("gtmoremachine.machine.wireless_energy_monitor.tooltip.now",
Component.literal(NumberUtils.formatBigDecimalNumberOrSic(avgEnergy)).withStyle(ChatFormatting.DARK_PURPLE),
Component.literal(NumberUtils.bigDecimalNumberOrSicText(avgEnergy, format)).withStyle(ChatFormatting.DARK_PURPLE),
Component.literal(FormattingUtil.voltageAmperage(avgEnergy).toEngineeringString()),
FormattingUtil.voltageName(avgEnergy)));

Expand Down Expand Up @@ -97,8 +97,15 @@ default List<Component> getDisplayText(Statistics statistics, Format format, Pow

for (Map.Entry<MetaMachine, ITransferData> m : entryList) {
UUID uuid = m.getValue().UUID();
BigInteger through = m.getValue().Throughput();
if (statistics == Statistics.Global || uuid.equals(TeamUtils.getTeamUUID(this.getUUID()))) {
textListCache.add(m.getValue().getInfo());
if (powerStatus == PowerStatus.All) {
textListCache.add(m.getValue().getInfo(format));
} else if (powerStatus == PowerStatus.In && through.compareTo(BigInteger.ZERO) > 0) {
textListCache.add(m.getValue().getInfo(format));
} else if (powerStatus == PowerStatus.Out && through.compareTo(BigInteger.ZERO) < 0) {
textListCache.add(m.getValue().getInfo(format));
}
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/main/java/cn/qiuye/gtmoremachine/utils/NumberUtils.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cn.qiuye.gtmoremachine.utils

import cn.qiuye.gtmoremachine.api.gui.monitor.Format

import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent

Expand All @@ -26,4 +28,22 @@ object NumberUtils {
@JvmStatic
fun formatBigIntegerNumberOrSic(number: BigInteger): String =
FormattingUtil.formatNumberReadable(BigDecimal(number))

@JvmStatic
fun bigDecimalNumberOrSicText(number: BigDecimal, format: Format): String = if (format ==
Format.Unit
) {
formatBigDecimalNumberOrSic(number)
} else {
FormattingUtil.DECIMAL_FORMAT_SIC_2F.format(number)
}

@JvmStatic
fun bigIntegerNumberOrSicText(number: BigInteger, format: Format): String = if (format ==
Format.Unit
) {
formatBigIntegerNumberOrSic(number)
} else {
FormattingUtil.DECIMAL_FORMAT_SIC_2F.format(BigDecimal(number))
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 6
}
}