Skip to content

Commit

Permalink
moved TheOneProbe formatter outside IC2C's module loading
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVas committed Oct 30, 2023
1 parent 4708c42 commit 9992390
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.19.2-43.3.0'

runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:3965693")
// runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:3965693")
implementation fg.deobf("mekanism:Mekanism:1.19.2-10.3.8.477")
runtimeOnly fg.deobf("curse.maven:jei-238222:4712866")

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx8G
org.gradle.daemon=false
mod_version = 1.19.2-1.0.1-forge
mod_version = 1.19.2-1.0.2-forge
modid = jadexic2c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseInventoryTileEntity;
import ic2.core.block.base.tiles.impls.BaseGeneratorTileEntity;
import ic2.core.block.generators.tiles.*;
import ic2.core.utils.math.ColorUtils;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand All @@ -34,17 +34,17 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (tile instanceof BaseGeneratorTileEntity gen) {
float euProduction = tag.getFloat("euProduction");
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(gen.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) euProduction, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) euProduction, 5));

Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", gen.getMaxEnergyOutput());
if (gen instanceof SolarTurbineTileEntity) {
int heat = tag.getInt("heat");
Helpers.text(iTooltip, Component.translatable("ic2.probe.heat.name", ProbePluginHelper.THERMAL_GEN.format((double) ((float) heat / 240.0F))).withStyle(ChatFormatting.WHITE));
Helpers.text(iTooltip, Component.translatable("ic2.probe.heat.name", Formatter.THERMAL_GEN.format((double) ((float) heat / 240.0F))).withStyle(ChatFormatting.WHITE));
Helpers.addClientTankFromTag(iTooltip, blockAccessor);
}
if (gen instanceof ThermalGeneratorTileEntity) {
float subProduction = tag.getFloat("subProduction");
Helpers.text(iTooltip, Component.translatable("ic2.probe.production.passive.name", ProbePluginHelper.THERMAL_GEN.format((double) subProduction)).withStyle(ChatFormatting.WHITE));
Helpers.text(iTooltip, Component.translatable("ic2.probe.production.passive.name", Formatter.THERMAL_GEN.format((double) subProduction)).withStyle(ChatFormatting.WHITE));
Helpers.addClientTankFromTag(iTooltip, blockAccessor);
}
if (gen instanceof GeoGenTileEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.ColorMix;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.tiles.readers.IEUStorage;
import ic2.core.block.base.tiles.BaseTileEntity;
import ic2.core.block.storage.tiles.CreativeSourceTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand All @@ -34,7 +34,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (tile instanceof CreativeSourceTileEntity) {
Helpers.barLiteral(iTooltip, 1, 1, Component.translatable("ic2.probe.eu.storage.name", "Infinite").withStyle(ChatFormatting.WHITE), ColorMix.RED);
} else if (tile instanceof IEUStorage storage) {
Helpers.barLiteral(iTooltip, stored, storage.getMaxEU(), Component.translatable("ic2.probe.eu.storage.name", ProbePluginHelper.formatNumber(stored, 5)).withStyle(ChatFormatting.WHITE), ColorMix.RED);
Helpers.barLiteral(iTooltip, stored, storage.getMaxEU(), Component.translatable("ic2.probe.eu.storage.name", Formatter.formatNumber(stored, 5)).withStyle(ChatFormatting.WHITE), ColorMix.RED);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.ColorMix;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseElectricTileEntity;
Expand All @@ -21,7 +22,6 @@
import ic2.core.block.machines.tiles.mv.CropHarvesterTileEntity;
import ic2.core.block.machines.tiles.mv.ReactorPlannerTileEntity;
import ic2.core.block.machines.tiles.mv.TeslaCoilTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -98,7 +98,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
float progress = tag.getFloat("uuProgress");
if (progress > 0.0F) {
Helpers.barLiteral(iTooltip, (int) progress, (int) massFab.getMaxProgress(), Component.translatable("ic2.probe.progress.moderate.name",
ProbePluginHelper.THERMAL_GEN.format((double) (progress / massFab.getMaxProgress()) * 100.0)), ColorMix.PURPLE);
Formatter.THERMAL_GEN.format((double) (progress / massFab.getMaxProgress()) * 100.0)), ColorMix.PURPLE);
}
if (tag.getInt("scrap") > 0) {
Helpers.barLiteral(iTooltip, tag.getInt("scrap"), tag.getInt("scrapValue") * 2, Component.translatable("ic2.probe.matter.amplifier.name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.ColorMix;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorChamber;
import ic2.api.reactor.ISteamReactor;
import ic2.core.block.generators.tiles.ElectricNuclearReactorTileEntity;
import ic2.core.platform.player.PlayerHandler;
import ic2.core.utils.helpers.Formatters;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -67,11 +67,11 @@ public static void addToTooltip(ITooltip tooltip, BlockEntity tile, BlockAccesso
if (PlayerHandler.getHandler(blockAccessor.getPlayer()).hasEUReader()) {
if (tile instanceof IReactor reactorTile) {
if (tile instanceof ElectricNuclearReactorTileEntity reactor) {
Helpers.text(tooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) reactor.getProvidedEnergy(), 5));
Helpers.text(tooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) reactor.getProvidedEnergy(), 5));
Helpers.text(tooltip, "ic2.probe.reactor.breeding.name", reactor.getHeat() / 3000 + 1);
} else if (tile instanceof ISteamReactor steamReactor) {
Helpers.text(tooltip, "ic2.probe.steam.output.name", ProbePluginHelper.THERMAL_GEN.format(steamReactor.getEnergyOutput() * 3.200000047683716));
Helpers.text(tooltip, "ic2.probe.water.consumption.name", ProbePluginHelper.THERMAL_GEN.format(steamReactor.getEnergyOutput() / 50.0));
Helpers.text(tooltip, "ic2.probe.steam.output.name", Formatter.THERMAL_GEN.format(steamReactor.getEnergyOutput() * 3.200000047683716));
Helpers.text(tooltip, "ic2.probe.water.consumption.name", Formatter.THERMAL_GEN.format(steamReactor.getEnergyOutput() / 50.0));
Helpers.text(tooltip, "ic2.probe.pump.pressure", 100);
Helpers.text(tooltip, "ic2.probe.pump.amount", Formatters.EU_FORMAT.format(20000L));
Helpers.addClientTankFromTag(tooltip, blockAccessor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.ColorMix;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseTileEntity;
import ic2.core.block.generators.tiles.OceanGeneratorTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -31,11 +31,11 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (tile instanceof OceanGeneratorTileEntity gen) {
float production = tag.getFloat("production");
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(gen.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", gen.getMaxEnergyOutput());

Helpers.bar(iTooltip, Integer.parseInt(ProbePluginHelper.formatInt(tag.getInt("water"), 4)), 1000, "ic2.probe.water.full.name", ColorMix.BLUE);
Helpers.bar(iTooltip, Integer.parseInt(ProbePluginHelper.formatInt(tag.getInt("coral"), 4)), 50, "ic2.probe.corals.full.name", ColorMix.PURPLE);
Helpers.bar(iTooltip, Integer.parseInt(Formatter.formatInt(tag.getInt("water"), 4)), 1000, "ic2.probe.water.full.name", ColorMix.BLUE);
Helpers.bar(iTooltip, Integer.parseInt(Formatter.formatInt(tag.getInt("coral"), 4)), 50, "ic2.probe.corals.full.name", ColorMix.PURPLE);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseInventoryTileEntity;
import ic2.core.block.generators.tiles.SolarPanelTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -32,7 +32,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
float production = tag.getFloat("production");
int maxProduction = tag.getInt("maxProduction");
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(panel.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", maxProduction);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseLinkingTileEntity;
import ic2.core.block.base.tiles.BaseMultiBlockTileEntity;
import ic2.core.block.base.tiles.BaseTileEntity;
import ic2.core.block.generators.tiles.SteamTunnelTileEntity;
import ic2.core.utils.math.ColorUtils;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
public void addInfo(SteamTunnelTileEntity tunnel, ITooltip iTooltip, CompoundTag tag) {
float energyProduction = tag.getFloat("energyProduction");
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(tunnel.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double)energyProduction, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double)energyProduction, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", tunnel.getMaxEnergyOutput());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseTileEntity;
import ic2.core.block.generators.tiles.SteamTurbineTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -29,7 +29,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (blockAccessor.getBlockEntity() instanceof BaseTileEntity tile) {
if (tile instanceof SteamTurbineTileEntity turbine) {
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(turbine.getSourceTier()));
Helpers.text(iTooltip,"ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) tag.getFloat("production"), 5));
Helpers.text(iTooltip,"ic2.probe.eu.output.current.name", Formatter.formatNumber((double) tag.getFloat("production"), 5));
Helpers.text(iTooltip,"ic2.probe.eu.output.max.name", turbine.getMaxEnergyOutput());
Helpers.addClientTankFromTag(iTooltip, blockAccessor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.tiles.teleporter.TeleporterTarget;
import ic2.core.IC2;
Expand All @@ -10,7 +11,6 @@
import ic2.core.utils.helpers.Formatters;
import ic2.core.utils.helpers.SanityHelper;
import ic2.core.utils.helpers.TeleportUtil;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -57,11 +57,11 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
break;
case FLUID:
Helpers.text(iTooltip,"ic2.probe.teleporter.cost", Formatters.EU_FORMAT.format((long)baseCost));
Helpers.text(iTooltip,"ic2.probe.teleporter.capacity", Component.translatable("ic2.probe.teleporter.capacity.fluid", ProbePluginHelper.formatNumber((double)(availableEnergy / (long)baseCost * 10L), 6)));
Helpers.text(iTooltip,"ic2.probe.teleporter.capacity", Component.translatable("ic2.probe.teleporter.capacity.fluid", Formatter.formatNumber((double)(availableEnergy / (long)baseCost * 10L), 6)));
break;
case ITEM:
Helpers.text(iTooltip,"ic2.probe.teleporter.cost", Formatters.EU_FORMAT.format((long)baseCost));
Helpers.text(iTooltip,"ic2.probe.teleporter.capacity", Component.translatable("ic2.probe.teleporter.capacity.item", ProbePluginHelper.formatNumber((double)(availableEnergy / (long)baseCost / 100L * 64L), 6)));
Helpers.text(iTooltip,"ic2.probe.teleporter.capacity", Component.translatable("ic2.probe.teleporter.capacity.item", Formatter.formatNumber((double)(availableEnergy / (long)baseCost / 100L * 64L), 6)));
break;
case SPAWNER:
Helpers.text(iTooltip,"ic2.probe.teleporter.cost", Formatters.EU_FORMAT.format((long)(baseCost * 25000)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseTileEntity;
import ic2.core.block.generators.tiles.WaveGenTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -31,7 +31,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (tile instanceof WaveGenTileEntity waveGen) {
float production = tag.getFloat("production");
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(waveGen.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) production, 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", waveGen.getMaxEnergyOutput());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import dev.crossvas.jadexic2c.IHelper;
import dev.crossvas.jadexic2c.JadeIC2CPluginHandler;
import dev.crossvas.jadexic2c.utils.Formatter;
import dev.crossvas.jadexic2c.utils.Helpers;
import ic2.api.energy.EnergyNet;
import ic2.core.block.base.tiles.BaseInventoryTileEntity;
import ic2.core.block.generators.tiles.WindmillTileEntity;
import ic2.probeplugin.base.ProbePluginHelper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -30,7 +30,7 @@ public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPlugi
if (blockAccessor.getBlockEntity() instanceof BaseInventoryTileEntity tile) {
if (tile instanceof WindmillTileEntity windmill) {
Helpers.text(iTooltip, "ic2.probe.eu.tier.name", EnergyNet.INSTANCE.getDisplayTier(windmill.getSourceTier()));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", ProbePluginHelper.formatNumber((double) tag.getFloat("production"), 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.current.name", Formatter.formatNumber((double) tag.getFloat("production"), 5));
Helpers.text(iTooltip, "ic2.probe.eu.output.max.name", windmill.getMaxEnergyOutput());
}
}
Expand Down
Loading

0 comments on commit 9992390

Please sign in to comment.