aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2022-02-06 20:47:22 +0100
committerTec <daniel112092@gmail.com>2022-02-06 20:47:22 +0100
commitfe3e8abfbb46a4fd75906e3d41e0dfb4435b8403 (patch)
treec0c0bb04d96025c85fcef5bec276ea74c6b02294 /src/main/java
parent5f14081a2b88c07ff95325ddfa9ec88bf4c33e2a (diff)
downloadGT5-Unofficial-fe3e8abfbb46a4fd75906e3d41e0dfb4435b8403.tar.gz
GT5-Unofficial-fe3e8abfbb46a4fd75906e3d41e0dfb4435b8403.tar.bz2
GT5-Unofficial-fe3e8abfbb46a4fd75906e3d41e0dfb4435b8403.zip
More locale work
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java39
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java40
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java68
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java15
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java15
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java124
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java7
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java61
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java22
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java56
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java40
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java35
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/ClientProxy.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java69
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java52
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java71
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java126
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java16
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java10
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java60
-rw-r--r--src/main/java/com/github/technus/tectech/util/CommonValues.java49
-rw-r--r--src/main/java/com/github/technus/tectech/util/TT_Utility.java41
27 files changed, 415 insertions, 632 deletions
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java
index f4ad25f053..ce11976020 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java
@@ -37,7 +37,7 @@ public class TurretHeadItemEM extends ItemBlock {
list.add(EnumChatFormatting.DARK_PURPLE + "--" + translateToLocal("tooltip.damage.label") + "--");
list.add(translateToLocal("tooltip.damage.stat") + ": " + EnumChatFormatting.WHITE + (float)ConfigHandler.getLaserTurretSettings().getDamage() / 2.0F + ' ' + translateToLocal("tooltip.health"));
list.add(translateToLocal("tooltip.aoe") + ": " + EnumChatFormatting.WHITE + '0');
- list.add(translateToLocal("tooltip.firerate") + ": " + EnumChatFormatting.WHITE + df.format((double)(20.0F / (float)ConfigHandler.getLaserTurretSettings().getFireRate())));
+ list.add(translateToLocal("tooltip.firerate") + ": " + EnumChatFormatting.WHITE + df.format(20.0F / (float)ConfigHandler.getLaserTurretSettings().getFireRate()));
list.add(translateToLocal("tooltip.energy.stat") + ": " + EnumChatFormatting.WHITE + ConfigHandler.getLaserTurretSettings().getPowerUsage() + " RF");
list.add("");
list.add(EnumChatFormatting.DARK_GRAY + translateToLocal("flavour.turret.4"));
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
index be1ed9bd51..c2d93cf0fd 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
@@ -6,18 +6,14 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
-import com.github.technus.tectech.util.TT_Utility;
-
-import java.util.ArrayList;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
-import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
@@ -125,7 +121,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
}
@Override
- protected String getIndirectTagValue() {
+ protected String getTagValue() {
return nbtType;
}
@@ -230,35 +226,4 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
public int hashCode() {
return hash;
}
-
- @Override
- public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) {
- if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) {
- lines.add(getShortSymbol());
- }
- }
-
- @Override
- public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) {
- if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
- lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType());
- }
- if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) {
- lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName());
- //lines.add("SYMBOL = "+getSymbol());
- }
- if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) {
- lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e");
- }
- if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) {
- lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR"));
- }
- if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) {
- lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2");
- }
- if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add(translateToLocal("tt.keyphrase.LIFE_TIME") + " = " + getRawTimeSpan(energyLevel) + " s");
- lines.add(" " + translateToLocal("tt.keyphrase.At_current_energy_level"));
- }
- }
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java
index bb61f50aab..32b0893d8b 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java
@@ -15,7 +15,9 @@ public class CancerCommand implements ICommand {
public CancerCommand(){
aliases.add("cancer_EM");
aliases.add("cancer");
+ aliases.add("sanser_EM");
aliases.add("sanser");
+ aliases.add("sancer_EM");
aliases.add("sancer");
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
index 13838cf443..be22092163 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
@@ -60,8 +60,8 @@ public abstract class EMComplexTemplate implements IEMDefinition {
}
public NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
- return registry.indirectToNBT(getIndirectTagValue(),getSubParticles());
+ return registry.indirectToNBT(getTagValue(),getSubParticles());
}
- protected abstract String getIndirectTagValue();
+ protected abstract String getTagValue();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
index edf1827a07..272e7cffc0 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
@@ -1,15 +1,10 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.definitions;
-import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
import net.minecraft.nbt.NBTTagCompound;
-import java.util.ArrayList;
-
-import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
-import static com.github.technus.tectech.util.TT_Utility.areBitsSet;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
@@ -169,8 +164,8 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
}
@Override
- protected final String getIndirectTagValue() {
- throw new EMException("This class should only be used directly!");
+ protected final String getTagValue() {
+ return bind;
}
@Override
@@ -183,37 +178,6 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
}
@Override
- public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) {
- if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add(getShortSymbol());
- }
- }
-
- @Override
- public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) {
- if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
- lines.add("DIRECT = " + bind + ' ' + getMatterMassType());
- }
- if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add("NAME = "+ getLocalizedName());
- lines.add("SYMBOL = "+getSymbol());
- }
- if(areBitsSet(SCAN_GET_CHARGE,capabilities)) {
- lines.add("CHARGE = " + getCharge() / 3D + " e");
- }
- if(areBitsSet(SCAN_GET_COLOR,capabilities)) {
- lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR");
- }
- if(areBitsSet(SCAN_GET_MASS,capabilities)) {
- lines.add("MASS = " + getMass() + " eV/c\u00b2");
- }
- if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){
- lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s");
- lines.add(" "+"At current energy level");
- }
- }
-
- @Override
public final int compareTo(IEMDefinition o) {
if (getMatterMassType() == o.getMatterMassType()) {
int oID = ((EMPrimitiveTemplate) o).ID;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
index aae5a8caca..ee123735f8 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
@@ -4,18 +4,23 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.util.TT_Utility;
import net.minecraft.nbt.NBTTagCompound;
import java.util.ArrayList;
+import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
+import static com.github.technus.tectech.util.TT_Utility.areBitsSet;
+import static net.minecraft.util.StatCollector.translateToLocal;
+
/**
* Created by danie_000 on 11.11.2016.
*/
-public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IMMUTABLE
- double STABLE_RAW_LIFE_TIME =1.5e36D;
- double NO_DECAY_RAW_LIFE_TIME =-1D;
- long DEFAULT_ENERGY_LEVEL =0;
- double DEFAULT_ENERGY_REQUIREMENT =25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels
+public interface IEMDefinition extends Comparable<IEMDefinition>, Cloneable {//IMMUTABLE
+ double STABLE_RAW_LIFE_TIME = 1.5e36D;
+ double NO_DECAY_RAW_LIFE_TIME = -1D;
+ long DEFAULT_ENERGY_LEVEL = 0;
+ double DEFAULT_ENERGY_REQUIREMENT = 25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels
//add text based creators for recipe formula input?
//Nomenclature
@@ -23,17 +28,52 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
String getShortLocalizedName();
- default String getLocalizedName(){
- return getLocalizedTypeName()+": "+getShortLocalizedName();
+ default String getLocalizedName() {
+ return getLocalizedTypeName() + ": " + getShortLocalizedName();
}
String getShortSymbol();
String getSymbol();
- void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel);
+ default void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel, EMDefinitionsRegistry registry) {
+ if (areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CLASS_TYPE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add(getShortSymbol());
+ }
+ }
- void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel);
+ default void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel, EMDefinitionsRegistry registry) {
+ if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add(translateToLocal("tt.keyword.scan.class") +
+ " = " + registry.getTypes().get(getClass()).getLocalizedName());
+ if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) {
+ lines.add(translateToLocal("tt.keyword.scan.name") +
+ " = " + getLocalizedName());
+ lines.add(translateToLocal("tt.keyword.scan.symbol") +
+ " = " + getSymbol());
+ }
+ }
+ if (areBitsSet(SCAN_GET_CHARGE, capabilities)) {
+ lines.add(translateToLocal("tt.keyword.scan.charge") +
+ " = " + getCharge() / 3D + " " + translateToLocal("tt.keyword.unit.charge"));
+ }
+ if (areBitsSet(SCAN_GET_COLORABLE, capabilities)) {
+ lines.add(hasColor() ?
+ translateToLocal("tt.keyword.scan.colored") :
+ translateToLocal("tt.keyword.scan.colorless"));
+ }
+ if (areBitsSet(SCAN_GET_MASS, capabilities)) {
+ lines.add(translateToLocal("tt.keyword.scan.mass") +
+ " = " + getMass() + " " + translateToLocal("tt.keyword.unit.mass"));
+ }
+ if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add((isTimeSpanHalfLife() ?
+ translateToLocal("tt.keyword.scan.half_life") :
+ translateToLocal("tt.keyword.scan.life_time")) +
+ " = " + getRawTimeSpan(energyLevel) + " " + translateToLocal("tt.keyword.unit.time"));
+ lines.add(" " + translateToLocal("tt.keyphrase.scan.at_current_energy_level"));
+ }
+ }
int getMatterMassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED
@@ -65,8 +105,8 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
//dynamically changing stuff
int getMaxColors();
- default boolean hasColor(){
- return getMaxColors()>0;
+ default boolean hasColor() {
+ return getMaxColors() > 0;
}
double getRawTimeSpan(long currentEnergy);//defined in static fields or generated
@@ -77,11 +117,11 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
NBTTagCompound toNBT(EMDefinitionsRegistry registry);
- default EMDefinitionStack getStackForm(double amount){
- return new EMDefinitionStack(this,amount);
+ default EMDefinitionStack getStackForm(double amount) {
+ return new EMDefinitionStack(this, amount);
}
- default IEMDefinition clone(){
+ default IEMDefinition clone() {
return this;
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java
index f6bef9910e..ed2ebbab57 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java
@@ -1,16 +1,16 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Collections;
import java.util.NavigableMap;
import java.util.TreeMap;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.util.TT_Utility.unpackNBT;
/**
* Created by Tec on 12.05.2017.
@@ -47,13 +47,6 @@ public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap<EMDefiniti
}
public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException {
- EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")];
- for (int i = 0; i < defStacks.length; i++) {
- defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i)));
- if (defStacks[i].getDefinition().equals(nbtE__)) {
- throw new EMException("Something went Wrong");
- }
- }
- return new EMConstantStackMap(defStacks);
+ return new EMConstantStackMap(unpackNBT(EMDefinitionStack.class,inner -> EMDefinitionStack.fromNBT(registry, inner),nbt));
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java
index 57b8f7bf1c..6892e2cd59 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java
@@ -1,15 +1,15 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.NavigableMap;
import java.util.TreeMap;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.util.TT_Utility.unpackNBT;
/**
* Created by danie_000 on 22.01.2017.
@@ -45,13 +45,6 @@ public final class EMDefinitionStackMap extends EMStackMap<EMDefinitionStack> im
}
public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException {
- EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")];
- for (int i = 0; i < defStacks.length; i++) {
- defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i)));
- if (defStacks[i].getDefinition().equals(nbtE__)) {
- throw new EMException("Something went Wrong");
- }
- }
- return new EMDefinitionStackMap(defStacks);
+ return new EMDefinitionStackMap(unpackNBT(EMDefinitionStack.class,inner -> EMDefinitionStack.fromNBT(registry, inner),nbt));
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java
index bfaad77c33..8a92c819df 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java
@@ -18,8 +18,8 @@ import java.util.NavigableMap;
import java.util.TreeMap;
import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
import static com.github.technus.tectech.util.DoubleCount.add;
+import static com.github.technus.tectech.util.TT_Utility.unpackNBT;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
@@ -27,7 +27,8 @@ import static net.minecraft.util.StatCollector.translateToLocal;
*/
public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implements IEMMapWrite<EMInstanceStack> {
//Constructors
- public EMInstanceStackMap() {}
+ public EMInstanceStackMap() {
+ }
public EMInstanceStackMap(EMInstanceStack... inSafe) {
this(true, inSafe);
@@ -35,8 +36,8 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
public EMInstanceStackMap(boolean clone, EMInstanceStack... in) {
if (clone) {
- EMInstanceStack[] stacks =new EMInstanceStack[in.length];
- for(int i=0;i<stacks.length;i++) {
+ EMInstanceStack[] stacks = new EMInstanceStack[in.length];
+ for (int i = 0; i < stacks.length; i++) {
stacks[i] = in[i].clone();
}
putUnifyAll(stacks);
@@ -50,9 +51,9 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
}
private EMInstanceStackMap(boolean clone, NavigableMap<IEMDefinition, EMInstanceStack> in) {
- super(clone?new TreeMap<>():in);
+ super(clone ? new TreeMap<>() : in);
if (clone) {
- for(EMInstanceStack stack:in.values()) {
+ for (EMInstanceStack stack : in.values()) {
putUnify(stack.clone());
}
}
@@ -72,11 +73,11 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
public double removeOverflow(int stacksCount, double stackCapacity) {
double massRemoved = 0;
- if (getBackingMap().size() > stacksCount) {
+ if (size() > stacksCount) {
IEMDefinition[] keys = keySetToArray();
for (int i = stacksCount; i < keys.length; i++) {
- massRemoved += getBackingMap().get(keys[i]).getDefinitionStack().getMass();
- getBackingMap().remove(keys[i]);
+ massRemoved += get(keys[i]).getDefinitionStack().getMass();
+ removeKey(keys[i]);
}
}
@@ -91,44 +92,38 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
//Getters
public String[] getElementalInfo() {
- String[] info = new String[getBackingMap().size()];
- int i = 0;
- for (EMInstanceStack instance : getBackingMap().values()) {
- info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+
- " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+
- " #: " + EnumChatFormatting.GREEN + TT_Utility.formatNumberExp(instance.getAmount() /AVOGADRO_CONSTANT) +" "+translateToLocal("tt.keyword.mol")+ EnumChatFormatting.RESET+
- " E: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(instance.getEnergy()) + EnumChatFormatting.RESET+
- " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?translateToLocal("tt.keyword.stable"):TT_Utility.formatNumberShortExp(instance.getLifeTime()));
+ String[] info = new String[size()];
+ int i = 0;
+ for (Map.Entry<IEMDefinition, EMInstanceStack> entry : entrySet()) {
+ EMInstanceStack instance = entry.getValue();
+ info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName() + " " + EnumChatFormatting.AQUA + instance.getDefinition().getSymbol() + EnumChatFormatting.RESET +
+ " " + translateToLocal("tt.keyword.short.amount") + ": " + EnumChatFormatting.GREEN + TT_Utility.formatNumberExp(instance.getAmount() / AVOGADRO_CONSTANT) + " " + translateToLocal("tt.keyword.unit.mol") + EnumChatFormatting.RESET +
+ " " + translateToLocal("tt.keyword.short.energy") + ": " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(instance.getDefinition().getEnergyDiffBetweenStates(0, instance.getEnergy())) + " " + translateToLocal("tt.keyword.unit.energy") + EnumChatFormatting.RESET +
+ " " + translateToLocal("tt.keyword.short.charge") + ": " + EnumChatFormatting.GREEN + TT_Utility.formatNumberExp(instance.getCharge()) + " " + translateToLocal("tt.keyword.unit.charge") + EnumChatFormatting.RESET +
+ " " + translateToLocal("tt.keyword.short.time") + ": " + EnumChatFormatting.GREEN + (instance.getLifeTime() < 0 ?
+ translateToLocal("tt.keyword.stable") : TT_Utility.formatNumberShortExp(instance.getLifeTime()) + " " + translateToLocal("tt.keyword.unit.time")) + EnumChatFormatting.RESET;
}
return info;
}
- public ArrayList<String> getScanShortSymbols(int[] capabilities) {
- ArrayList<String> list=new ArrayList<>(16);
- for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){
- e.getValue().addScanShortSymbols(list,capabilities);
- }
- return list;
- }
-
public ArrayList<String> getScanInfo(int[] capabilities) {
- ArrayList<String> list=new ArrayList<>(16);
- for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){
- e.getValue().addScanResults(list,capabilities);
+ ArrayList<String> list = new ArrayList<>(16);
+ for (Map.Entry<IEMDefinition, EMInstanceStack> e : entrySet()) {
+ e.getValue().addScanResults(list, capabilities);
}
return list;
}
- public double tickContent(double lifeTimeMult, int postEnergize, double seconds){
+ public double tickContent(double lifeTimeMult, int postEnergize, double seconds) {
//cleanUp();
- double diff=0;
+ double diff = 0;
for (EMInstanceStack instance : takeAllToArray()) {
instance.setAge(instance.getAge() + seconds);
EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize);
if (newInstances == null) {
putUnify(instance);
} else {
- diff=add(diff,newInstances.getMassDiff());
+ diff = add(diff, newInstances.getMassDiff());
putUnifyAll(newInstances.getOutput());
}
}
@@ -136,55 +131,28 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
}
//NBT
- public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) {
- NBTTagCompound nbt = new NBTTagCompound();
- ArrayList<String> info = getScanShortSymbols(capabilities);
- nbt.setInteger("i", info.size());
- for (int i = 0; i < info.size(); i++) {
- nbt.