Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 27bb1a6

Browse files
committed
update dump command with new fluid stuff
1 parent 8215fef commit 27bb1a6

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

src/main/java/net/htmlcsjs/htmlTech/common/command/CommandDumpMaterials.java

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
import com.google.gson.Gson;
44
import gregtech.api.GregTechAPI;
5+
import gregtech.api.recipes.recipeproperties.TemperatureProperty;
56
import gregtech.api.unification.material.Material;
67
import gregtech.api.unification.material.properties.*;
78
import gregtech.api.unification.stack.MaterialStack;
89
import gregtech.api.util.GTUtility;
10+
import net.htmlcsjs.htmlTech.HtmlTech;
911
import net.minecraft.command.CommandException;
1012
import net.minecraft.command.ICommandSender;
1113
import net.minecraft.server.MinecraftServer;
1214
import net.minecraftforge.server.command.CommandTreeBase;
1315

1416
import java.io.FileWriter;
1517
import java.io.IOException;
16-
import java.util.ArrayList;
17-
import java.util.HashMap;
18-
import java.util.List;
19-
import java.util.Map;
18+
import java.lang.reflect.Method;
19+
import java.util.*;
20+
import java.util.stream.Collectors;
2021

2122
import static gregtech.api.GTValues.VN;
2223

@@ -35,7 +36,7 @@ public String getUsage(ICommandSender sender) {
3536
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
3637
Map<String, Object> materialsData = new HashMap<>();
3738
List<Map<String, Object>> materialsArray = new ArrayList<>();
38-
for (Material material: GregTechAPI.MaterialRegistry.getAllMaterials()) {
39+
for (Material material : GregTechAPI.MaterialRegistry.getAllMaterials()) {
3940
Map<String, Object> materialData = new HashMap<>();
4041
// dump simple stuff
4142
materialData.put("unlocalized_name", material.getUnlocalizedName());
@@ -52,11 +53,17 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
5253

5354
if (properties.hasProperty(PropertyKey.WIRE)) {
5455
WireProperties wireProperties = material.getProperty(PropertyKey.WIRE);
55-
propertiesMap.put("wire", String.format("Voltage: %s, Amperage: %d, Loss: %d", VN[GTUtility.getTierByVoltage(wireProperties.getVoltage())], wireProperties.getAmperage(), wireProperties.getLossPerBlock()));
56+
propertiesMap.put("wire", String.format("Voltage: %s, Amperage: %d, Loss: %d",
57+
VN[GTUtility.getTierByVoltage(wireProperties.getVoltage())],
58+
wireProperties.getAmperage(),
59+
wireProperties.getLossPerBlock()));
5660
}
5761
if (properties.hasProperty(PropertyKey.TOOL)) {
5862
ToolProperty toolProperty = material.getProperty(PropertyKey.TOOL);
59-
propertiesMap.put("tool", String.format("Speed: %f, Durability: %d, Dmg: %f", toolProperty.getToolSpeed(), toolProperty.getToolDurability(), toolProperty.getToolAttackDamage()));
63+
propertiesMap.put("tool", String.format("Speed: %f, Durability: %d, Dmg: %f",
64+
toolProperty.getToolSpeed(),
65+
toolProperty.getToolDurability(),
66+
toolProperty.getToolAttackDamage()));
6067
}
6168
if (properties.hasProperty(PropertyKey.ORE)) {
6269
propertiesMap.put("ore", true);
@@ -66,20 +73,38 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
6673
try {
6774
if (properties.hasProperty(PropertyKey.BLAST)) {
6875
BlastProperty blastProperty = material.getProperty(PropertyKey.BLAST);
69-
propertiesMap.put("blast", String.format("Temp: %d, Gas Tier: %s", blastProperty.getBlastTemperature(), blastProperty.getGasTier().toString()));
76+
Method reflectedGetTempTeir = TemperatureProperty.class.getDeclaredMethod("getMinTierForTemperature", Integer.class);
77+
reflectedGetTempTeir.setAccessible(true);
78+
propertiesMap.put("blast", String.format("Temp: %dK (%s), Gas Tier: %s",
79+
blastProperty.getBlastTemperature(),
80+
reflectedGetTempTeir.invoke(TemperatureProperty.getInstance(), blastProperty.getBlastTemperature()),
81+
blastProperty.getGasTier().toString()));
7082
}
71-
} catch (Exception ignored) {}
83+
} catch (Exception e) {
84+
HtmlTech.logger.error(e.getMessage(), Arrays.stream(e.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")));
85+
}
7286
if (properties.hasProperty(PropertyKey.FLUID_PIPE)) {
7387
FluidPipeProperties fluidPipeProperties = properties.getProperty(PropertyKey.FLUID_PIPE);
74-
propertiesMap.put("fluid_pipe", String.format("Throughput: %d, Max Temp: %dK, Channels: %d", fluidPipeProperties.getThroughput(), fluidPipeProperties.getMaxFluidTemperature(), fluidPipeProperties.getTanks()));
88+
propertiesMap.put("fluid_pipe", String.format("Throughput: %d, Max Temp: %dK, Acid proof: %b, Cryo proof: %b, Gas proof: %b, Plasma proof: %b",
89+
fluidPipeProperties.getThroughput(),
90+
fluidPipeProperties.getMaxFluidTemperature(),
91+
fluidPipeProperties.isAcidProof(),
92+
fluidPipeProperties.isCryoProof(),
93+
fluidPipeProperties.isGasProof(),
94+
fluidPipeProperties.isPlasmaProof()));
7595
}
7696
if (properties.hasProperty(PropertyKey.ITEM_PIPE)) {
7797
ItemPipeProperties itemPipeProperties = properties.getProperty(PropertyKey.ITEM_PIPE);
7898
propertiesMap.put("item_pipe", String.format("Throughput: %f, Priority: %d", itemPipeProperties.getTransferRate() * 64, itemPipeProperties.getPriority()));
7999
}
80100
if (properties.hasProperty(PropertyKey.FLUID)) {
81101
FluidProperty fluidProperty = properties.getProperty(PropertyKey.FLUID);
82-
propertiesMap.put("fluid_temp", String.format("Fluid Temp: %dK", fluidProperty.getFluidTemperature()));
102+
fluidProperty.isGas();
103+
fluidProperty.getFluidType().getName();
104+
propertiesMap.put("fluid", String.format("Temp: %dK, Gas: %b, Type: %s",
105+
fluidProperty.getFluidTemperature(),
106+
fluidProperty.isGas(),
107+
fluidProperty.getFluidType().getName()));
83108
}
84109
if (properties.hasProperty(PropertyKey.PLASMA)) {
85110
PlasmaProperty plasmaProperty = properties.getProperty(PropertyKey.PLASMA);

0 commit comments

Comments
 (0)