aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2019-02-16 10:00:48 +0100
committerBass <tudurap.com@gmail.com>2019-02-16 09:05:50 +0000
commit88124a202a65445e33697416fa6ee97ca8c024f5 (patch)
treee3d61b146b63472eea9d945fabe809cc73ee2505 /src/main
parentee4bd9f91d4b8f85b550730aa1e3c63d91b3be2f (diff)
downloadGT5-Unofficial-88124a202a65445e33697416fa6ee97ca8c024f5.tar.gz
GT5-Unofficial-88124a202a65445e33697416fa6ee97ca8c024f5.tar.bz2
GT5-Unofficial-88124a202a65445e33697416fa6ee97ca8c024f5.zip
Move to util
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java15
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java15
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java16
3 files changed, 15 insertions, 31 deletions
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 1fd479939c..7a5366f337 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -24,8 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +38,18 @@ public final class Util {
private Util() {
}
+ @SuppressWarnings("ComparatorMethodParameterNotUsed")
+ public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
+ SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(
+ (e1, e2) -> {
+ int res = e1.getValue().compareTo(e2.getValue());
+ return res != 0 ? res : 1; // Special fix to preserve items with equal values
+ }
+ );
+ sortedEntries.addAll(map.entrySet());
+ return sortedEntries;
+ }
+
public static String intBitsToString(int number) {
StringBuilder result = new StringBuilder(16);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index 926c5e5d30..eca3dde6cb 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -25,6 +25,7 @@ import java.util.*;
import static com.github.technus.tectech.CommonValues.V;
import static com.github.technus.tectech.Util.StructureBuilder;
+import static com.github.technus.tectech.Util.entriesSortedByValues;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
import static gregtech.api.GregTech_API.*;
@@ -78,20 +79,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
private long outputCurrentParam = 0;
private int scanTimeMinParam = 0;
- static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
- SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(
- new Comparator<Map.Entry<K, V>>() {
- @Override
- public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) {
- int res = e1.getValue().compareTo(e2.getValue());
- return res != 0 ? res : 1; // Special fix to preserve items with equal values
- }
- }
- );
- sortedEntries.addAll(map.entrySet());
- return sortedEntries;
- }
-
//region structure
private static final String[][] shape0 = new String[][]{//3 16 0
{"\u000F", "A . ",},
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
index 906ce556f7..c556ca2ef6 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
import java.util.*;
+import static com.github.technus.tectech.Util.entriesSortedByValues;
import static java.lang.Math.round;
@@ -41,25 +42,10 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB
private int transferRadiusTower = 32; //Radius for transceiver to tower transfers
private int transferRadiusCover = 16; //Radius for transceiver to cover transfers
-
private long outputVoltage = 512; //Tesla Voltage Output
private long outputCurrent = 1; //Tesla Current Output
private long outputEuT = outputVoltage * outputCurrent; //Tesla Power Output
- static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
- SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(
- new Comparator<Map.Entry<K, V>>() {
- @Override
- public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) {
- int res = e1.getValue().compareTo(e2.getValue());
- return res != 0 ? res : 1; // Special fix to preserve items with equal values
- }
- }
- );
- sortedEntries.addAll(map.entrySet());
- return sortedEntries;
- }
-
public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) {
super(aID, aName, aNameRegional, aTier, "Tesla Coil Transceiver", aSlotCount);