From b5399199a88d7c6c19a2ed494aa9c66b81bf2249 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 22 Jan 2022 23:33:56 +0100 Subject: Rework API, add locale --- src/main/resources/assets/tectech/lang/en_US.lang | 103 +++++++++++++++++++--- 1 file changed, 90 insertions(+), 13 deletions(-) (limited to 'src/main/resources/assets/tectech/lang/en_US.lang') diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 89d2b517a2..a5b5051827 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -798,20 +798,17 @@ gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front tt.keyword.ID=ID #Example: 32EU at 1A tt.keyword.at=at -#These are Thaumcraft aspects -tt.keyword.Air=Air -tt.keyword.Earth=Earth -tt.keyword.Fire=Fire -tt.keyword.Water=Water -tt.keyword.Order=Order -tt.keyword.Entropy=Entropy -tt.keyword.Primal=Primal -tt.keyword.Aspect=Aspect +#EM scan result tt.keyword.CLASS=CLASS tt.keyword.NAME=NAME tt.keyword.CHARGE=CHARGE tt.keyword.COLORLESS=COLORLESS tt.keyword.MASS=MASS +tt.keyphrase.LIFE_TIME=LIFE TIME +tt.keyphrase.CARRIES_COLOR=CARRIES COLOR +tt.keyphrase.Hint_Details=Hint Details +tt.keyphrase.At_current_energy_level=At current energy level +#debug boom tt.keyword.BOOM=BOOM! tt.keyword.Destination=Destination tt.keyword.Weight=Weight @@ -834,10 +831,6 @@ tt.keyword.Status=Status tt.keyword.Content=Content tt.keyword.PacketHistory=PacketHistory -tt.keyphrase.LIFE_TIME=LIFE TIME -tt.keyphrase.CARRIES_COLOR=CARRIES COLOR -tt.keyphrase.Hint_Details=Hint Details -tt.keyphrase.At_current_energy_level=At current energy level #Used when 0 Elemental Matter Stacks tt.keyphrase.No_Stacks=No Stacks tt.keyphrase.Contains_EM=Contains EM @@ -875,3 +868,87 @@ tt.keyphrase.Side_capabilities=Side capabilities #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret tile.turretBaseEM.name=Elemental Turret Base + +tt.keyword.mol=mol +tt.keyword.itemMols=items +tt.keyword.mbMols=mb +#EM types +tt.keyword.Primitive=Primitive +tt.keyword.Element=Element +tt.keyword.Atom=Atom +tt.keyword.Isotope=Isotope +tt.keyword.Boson=Boson +tt.keyword.Fermion=Fermion +tt.keyword.GaugeBoson=Gauge boson +tt.keyword.Meson=Meson +tt.keyword.Baryon=Baryon +tt.keyword.Tetraquark=Tetraquark +tt.keyword.Pentaquark=Pentaquark +tt.keyword.Hexaquark=Hexaquark +tt.keyword.Hadron=Hadron +tt.keyword.Neutrino=Neutrino +tt.keyword.Quark=Quark +tt.keyword.ScalarBoson=Scalar boson +#em definitions +tt.keyword.PrimitiveNBTERROR=NBT ERROR +tt.keyword.PrimitiveNULLPOINTER=NULL POINTER +tt.keyword.PrimitiveSpace=Space +tt.keyword.PrimitivePresence=Presence +tt.keyword.PrimitiveMass=Mass +tt.keyword.PrimitiveDarkMass=DarkMass +tt.keyword.PrimitiveEnergy=Energy +tt.keyword.PrimitiveDarkEnergy=DarkEnergy +tt.keyword.PrimitiveMagic=Magic +tt.keyword.PrimitiveAntimagic=Antimagic +tt.keyword.Gluon=Gluon +tt.keyword.Photon=Photon +tt.keyword.Weak0=Weak +tt.keyword.WeakPlus=Weak+ +tt.keyword.WeakMinus=Weak- +tt.keyword.Proton=Proton +tt.keyword.AntiProton=Antiproton +tt.keyword.Neutron=Neutron +tt.keyword.AntiNeutron=Antineutron +tt.keyword.Lepton=Lepton +tt.keyword.Electron=Electron +tt.keyword.Muon=Muon +tt.keyword.Tauon=Tauon +tt.keyword.Positron=Positron +tt.keyword.Antimuon=Antimuon +tt.keyword.Antitauon=Antitauon +tt.keyword.ElectronNeutrino=Electron neutrino +tt.keyword.MuonNeutrino=Muon neutrino +tt.keyword.TauonNeutrino=Tauon neutrino +tt.keyword.PositronNeutrino=Positron neutrino +tt.keyword.AntimuonNeutrino=Antimuon neutrino +tt.keyword.AntitauonNeutrino=Antitauon neutrino +tt.keyword.QuarkUp=Up +tt.keyword.QuarkCharm=Charm +tt.keyword.QuarkTop=Top +tt.keyword.QuarkDown=Down +tt.keyword.QuarkStrange=Strange +tt.keyword.QuarkBottom=Bottom +tt.keyword.QuarkAntiUp=Antiup +tt.keyword.QuarkAntiCharm=Anticharm +tt.keyword.QuarkAntiTop=Antitop +tt.keyword.QuarkAntiDown=Antidown +tt.keyword.QuarkAntiStrange=Antistrange +tt.keyword.QuarkAntiBottom=Antibottom +tt.keyword.Higgs=Higgs +#These are Thaumcraft aspects +tt.keyword.Air=Air +tt.keyword.Earth=Earth +tt.keyword.Fire=Fire +tt.keyword.Water=Water +tt.keyword.Order=Order +tt.keyword.Entropy=Entropy +tt.keyword.Chaos=Chaos + +tt.keyword.Primal=Primal +tt.keyword.Aspect=Aspect + + + + + + -- cgit From caff4351909ce59637348c6be94271cf1d1c0a9c Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 23 Jan 2022 14:47:42 +0100 Subject: Separate EM to new tab --- src/main/java/com/github/technus/tectech/TecTech.java | 4 +++- .../com/github/technus/tectech/loader/MainLoader.java | 2 ++ .../technus/tectech/loader/gui/CreativeTabEM.java | 19 +++++++++++++++++++ .../technus/tectech/mechanics/elementalMatter/README | 5 ++++- .../elementalMatter/core/maps/EMInstanceStackMap.java | 5 ----- .../item/DebugElementalInstanceContainer_EM.java | 4 ++-- .../thing/item/ElementalDefinitionContainer_EM.java | 10 +++++----- .../thing/item/ElementalDefinitionScanStorage_EM.java | 4 ++-- .../GT_MetaTileEntity_Hatch_ElementalContainer.java | 4 ++-- src/main/resources/assets/tectech/lang/en_US.lang | 1 + 10 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java (limited to 'src/main/resources/assets/tectech/lang/en_US.lang') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index d730d64a65..10b8f69b1a 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -3,6 +3,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -45,7 +46,8 @@ public class TecTech { public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; public static final LogHelper LOGGER = new LogHelper(Reference.MODID); - public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index e2f1e2882f..b9d737f98a 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.trans import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; @@ -64,6 +65,7 @@ public final class MainLoader { public static void preLoad(){ creativeTabTecTech =new CreativeTabTecTech("TecTech"); + creativeTabEM =new CreativeTabEM("EM"); //set expanded texture arrays for tiers try { diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java new file mode 100644 index 0000000000..cd73d1e420 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.loader.gui; + +import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class CreativeTabEM extends CreativeTabs { + public CreativeTabEM(String name) { + super(name); + } + + @SideOnly(Side.CLIENT) + @Override + public Item getTabIconItem() { + return ElementalDefinitionContainer_EM.INSTANCE; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README index f6c0b35e5f..c774b126c8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README @@ -41,4 +41,7 @@ Trees: InstanceStack - inst stack |||||multiple to 1 - InstanceStackTree - inst container - real things go here \ No newline at end of file + InstanceStackTree - inst container - real things go here + + Preset for world: + 2;7,16x22,16x35:11,16x35:3,16x35;0; \ No newline at end of file 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 64ff7063e8..265d219168 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 @@ -117,11 +117,6 @@ public final class EMInstanceStackMap extends EMStackMap implem return list; } - //Tick Content - public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { - return tickContent(lifeTimeMult,postEnergize,1D); - } - public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ //cleanUp(); double diff=0; diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index d909054196..ecebc6afcd 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -29,8 +29,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,7 +46,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); setTextureName(MODID + ":itemDebugContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index f0f59e0e86..0de8bb007a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; @@ -20,8 +20,8 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -35,7 +35,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); setTextureName(MODID + ":itemDefinitionContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } //return previous thing diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index 8b8133a1e2..1cb6de1df6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 84f18ad2bf..6cb83f5d46 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -112,7 +112,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { purgeOverflow(); - content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things + content.tickContent(1, postEnergize,1);//Hatches don't life time mult things purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -206,7 +206,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 128; + return mTier * mTier >> 4; } public double getMaxStackSize() { diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index a5b5051827..f69f250e78 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,5 +1,6 @@ #Creative Tab Name itemGroup.TecTech=TecTech Interdimensional +itemGroup.EM=TecTech Elemental Matter #Blocks tile.quantumStuff.name=Quantum Stuff -- cgit From 7adcaf6d9b4a8628711a01ce2467f13582cea7d5 Mon Sep 17 00:00:00 2001 From: Tec Date: Thu, 27 Jan 2022 22:09:30 +0100 Subject: Cleanup Atoms Localization, and FontRenderer --- .../technus/tectech/font/TecTechFontRender.java | 240 ++++++++++++------ .../definitions/complex/EMAtomDefinition.java | 113 ++++----- .../item/DebugElementalInstanceContainer_EM.java | 9 +- src/main/resources/META-INF/tectech_at.cfg | 17 +- src/main/resources/assets/tectech/lang/en_US.lang | 268 ++++++++++++++++++++- 5 files changed, 498 insertions(+), 149 deletions(-) (limited to 'src/main/resources/assets/tectech/lang/en_US.lang') diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index 4aea8bce92..fbbc12fe36 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -1,85 +1,182 @@ package com.github.technus.tectech.font; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.settings.GameSettings; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - @SideOnly(Side.CLIENT) public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - private static float DISTANCE_L = .125F; - private static float DISTANCE_L2 = DISTANCE_L *2F; + private static float DISTANCE_L = .125F; + private static float DISTANCE_L2 = DISTANCE_L * 2F; - private static float DISTANCE_M = 0.06F; - private static float DISTANCE_M2 = DISTANCE_M *2F; + private static float DISTANCE_M = 0.06F; + private static float DISTANCE_M2 = DISTANCE_M * 2F; - private static float DISTANCE_A = 0.06F; - private static float DISTANCE_A2 = DISTANCE_A *2F; + private static float DISTANCE_A = 0.06F; + private static float DISTANCE_A2 = DISTANCE_A * 2F; - private static final Method reset; - private static final Method render; - private final GameSettings gameSettings; + private TecTechFontRender() { + super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); + } - static { - Method resetMethod,renderMethod; - try { - resetMethod =FontRenderer.class.getDeclaredMethod("resetStyles"); - renderMethod=FontRenderer.class.getDeclaredMethod("renderString", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException e) { - try { - resetMethod =FontRenderer.class.getDeclaredMethod("func_78265_b"); - renderMethod=FontRenderer.class.getDeclaredMethod("func_78258_a", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException ex) { - throw new RuntimeException("Cannot get methods!",ex); - } - } - resetMethod.setAccessible(true); - renderMethod.setAccessible(true); - reset=resetMethod; - render=renderMethod; + private void resetStyles() { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; } - private TecTechFontRender() { - super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); - gameSettings = Minecraft.getMinecraft().gameSettings; + private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_) { + if (p_78258_1_ == null) { + return 0; + } else { + if (this.bidiFlag) { + p_78258_1_ = this.bidiReorder(p_78258_1_); + } + + if ((p_78258_4_ & -67108864) == 0) { + p_78258_4_ |= -16777216; + } + + if (p_78258_5_) { + p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; + } + + this.red = (float)(p_78258_4_ >> 16 & 255) / 255.0F; + this.blue = (float)(p_78258_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_78258_4_ & 255) / 255.0F; + this.alpha = (float)(p_78258_4_ >> 24 & 255) / 255.0F; + this.setColor(this.red, this.blue, this.green, this.alpha); + this.posX = (float)p_78258_2_; + this.posY = (float)p_78258_3_; + this.renderStringAtPos(p_78258_1_, p_78258_5_); + return (int)this.posX; + } } - private void resetStyles2(){ + private String bidiReorder(String p_147647_1_) { try { - reset.invoke(this); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method resetStyles!",e); + Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); + bidi.setReorderingMode(0); + return bidi.writeReordered(2); + } catch (ArabicShapingException var3) { + return p_147647_1_; } } - private int renderString2(String str, int x, int y, int color, boolean dropShadow){ - try { - return (int)render.invoke(this,str,x,y,color,dropShadow); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method renderString!",e); + private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { + for(int i = 0; i < p_78255_1_.length(); ++i) { + char c0 = p_78255_1_.charAt(i); + int j; + int k; + if (c0 == 167 && i + 1 < p_78255_1_.length()) { + j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); + if (j < 16) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + if (j < 0 || j > 15) { + j = 15; + } + + if (p_78255_2_) { + j += 16; + } + + k = this.colorCode[j]; + this.textColor = k; + this.setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } else if (j == 16) { + this.randomStyle = true; + } else if (j == 17) { + this.boldStyle = true; + } else if (j == 18) { + this.strikethroughStyle = true; + } else if (j == 19) { + this.underlineStyle = true; + } else if (j == 20) { + this.italicStyle = true; + } else if (j == 21) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + this.setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; + } else { + j = "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(c0); + if (this.randomStyle && j != -1) { + do { + k = this.fontRandom.nextInt(this.charWidth.length); + } while(this.charWidth[j] != this.charWidth[k]); + + j = k; + } + + float f1 = this.unicodeFlag ? 0.5F : 1.0F; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + float f = this.renderCharAtPos(j, c0, this.italicStyle); + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + if (this.boldStyle) { + this.posX += f1; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + this.renderCharAtPos(j, c0, this.italicStyle); + this.posX -= f1; + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + ++f; + } + + this.doDraw(f); + } } + } + private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { + return p_78278_2_ == ' ' ? 4.0F : ("ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); + } @Override public int drawString(String str, int x, int y, int color, boolean dropShadow) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_A2, 0, 0F); @@ -106,8 +203,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_M2, 0, 0F); @@ -132,8 +228,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_L2, 0, 0F); @@ -159,7 +254,7 @@ public class TecTechFontRender extends FontRenderer { @Override public void drawSplitString(String str, int x, int y, int maxWidth, int color) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; @@ -213,50 +308,40 @@ public class TecTechFontRender extends FontRenderer { private int drawStringFront(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); } private int drawStringBack(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); } @Override - public int getStringWidth(String p_78256_1_) - { - if(gameSettings.guiScale==1){ + public int getStringWidth(String p_78256_1_) { + if (Minecraft.getMinecraft().gameSettings.guiScale == 1) { return Minecraft.getMinecraft().fontRenderer.getStringWidth(p_78256_1_); } - if (p_78256_1_ == null) - { + if (p_78256_1_ == null) { return 0; - } - else - { - int i = 0; + } else { + int i = 0; boolean flag = false; - for (int j = 0; j < p_78256_1_.length(); ++j) - { + for (int j = 0; j < p_78256_1_.length(); ++j) { char c0 = p_78256_1_.charAt(j); - int k = this.getCharWidth(c0); + int k = this.getCharWidth(c0); - if (k < 0 && j < p_78256_1_.length() - 1) - { + if (k < 0 && j < p_78256_1_.length() - 1) { ++j; c0 = p_78256_1_.charAt(j); - if (c0 != 108 && c0 != 76) - { - if (c0 == 114 || c0 == 82) - { + if (c0 != 108 && c0 != 76) { + if (c0 == 114 || c0 == 82) { flag = false; } - } - else - { + } else { flag = true; } @@ -265,8 +350,7 @@ public class TecTechFontRender extends FontRenderer { i += k; - if (flag && k > 0) - { + if (flag && k > 0) { ++i; } } @@ -274,4 +358,6 @@ public class TecTechFontRender extends FontRenderer { return i; } } + + } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java index 76f4457e94..49fd8b5b54 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -5,8 +5,8 @@ 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.maps.EMDefinitionStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; @@ -27,12 +27,17 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; +import static java.lang.Math.abs; import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 18.11.2016. */ public class EMAtomDefinition extends EMComplexTemplate { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; private static final byte BYTE_OFFSET = 32; @@ -118,7 +123,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (def.getGeneration() < 0) { containsAnti = true; } - type = Math.max(type, Math.abs(def.getGeneration())); + type = Math.max(type, abs(def.getGeneration())); if (def instanceof EMLeptonDefinition) { cLeptons += stack.getCharge(); @@ -140,12 +145,12 @@ public class EMAtomDefinition extends EMComplexTemplate { this.neutralCount = neutralCount; this.element = element; - element = Math.abs(element); + element = abs(element); //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); iaea = EMNuclideIAEA.get(element, neutralCount); @@ -215,7 +220,7 @@ public class EMAtomDefinition extends EMComplexTemplate { if (element == 0) { return 1e-35D; } else if (element == 1) { - unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; + unstabilityEXP = 1.743D - abs(izoDiff - 1) * 9.743D; } else if (element == 2) { switch (isotope) { case 4: @@ -234,9 +239,9 @@ public class EMAtomDefinition extends EMComplexTemplate { } else if (element <= 83 || isotope <= 127 && element <= 120) { double elementPow4 = Math.pow(element, 4); - unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - abs(izoDiff) * (3D - element / 13D + element * element / 1600D); } else { return -1; } @@ -334,63 +339,51 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public String getLocalizedName() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - if (Math.abs(getGeneration()) != 1) { - return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; - } - return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=NAME.length){ + StringBuilder s = new StringBuilder(); + if(anti){ + s.append(translateToLocal("tt.IUPAC.Anti")); + do { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } while (element > 0); + }else { + while (element >= 10) { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); } - return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element; + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override public String getSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); - } - } + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge(); } @Override public String getShortSymbol() { - int element = Math.abs(this.getElement()); - boolean negative = this.getElement() < 0; - try { - return (negative ? "~" : "") + Nomenclature.SYMBOL[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } + int element = abs(this.getElement()); + boolean anti = this.getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=SYMBOL.length){ + StringBuilder s = new StringBuilder(anti?"~":""); + while (element >= 10) { + s.append(SYMBOL_IUPAC[element % 10]); + element = element / 10; + } + s.append(SYMBOL_IUPAC[element + 10]); + s.append(weird?translateToLocal("tt.keyword.Weird"):""); + return s.toString(); } + return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); } @Override @@ -1133,7 +1126,7 @@ public class EMAtomDefinition extends EMComplexTemplate { private boolean Fission(ArrayList decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { EMDefinitionStackMap heavy = new EMDefinitionStackMap(); - double[] liquidDrop = liquidDropFunction(Math.abs(getElement()) <= 97); + double[] liquidDrop = liquidDropFunction(abs(getElement()) <= 97); for (EMDefinitionStack stack : fissile.valuesToArray()) { if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && @@ -1226,7 +1219,7 @@ public class EMAtomDefinition extends EMComplexTemplate { return decays.toArray(EMDecay.NO_PRODUCT); } } - if (energyLevel < Math.abs(getCharge()) / 3 + getNeutralCount()) { + if (energyLevel < abs(getCharge()) / 3 + getNeutralCount()) { return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); @@ -1363,12 +1356,6 @@ public class EMAtomDefinition extends EMComplexTemplate { return element; } - private static final class Nomenclature { - private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - @Override protected String getIndirectTagValue() { return nbtType; @@ -1398,7 +1385,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int StableIsotope = stableIzoCurve(element); int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { @@ -1415,7 +1402,7 @@ public class EMAtomDefinition extends EMComplexTemplate { //stability curve int Isotope = stableIzoCurve(element); int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); + int izoDiffAbs = abs(izoDiff); double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); TreeMap isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); isotopes.put(rawLifeTime, isotope);//todo dont add stable ones diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index ecebc6afcd..b8ce40b180 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -141,9 +141,12 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE that.setTagCompound(new NBTTagCompound()); list.add(that); for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } diff --git a/src/main/resources/META-INF/tectech_at.cfg b/src/main/resources/META-INF/tectech_at.cfg index e09e575a7d..fa76d13c1f 100644 --- a/src/main/resources/META-INF/tectech_at.cfg +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -1,2 +1,17 @@ public net.minecraft.block.Block field_149781_w #blockResistance -public net.minecraft.block.Block field_149782_v #blockHardness \ No newline at end of file +public net.minecraft.block.Block field_149782_v #blockHardness +protected net.minecraft.client.gui.FontRenderer field_111274_c #unicodePageLocations +protected net.minecraft.client.gui.FontRenderer field_78285_g #colorCode +protected net.minecraft.client.gui.FontRenderer field_78298_i #renderEngine +protected net.minecraft.client.gui.FontRenderer field_78293_l #unicodeFlag +protected net.minecraft.client.gui.FontRenderer field_78294_m #bidiFlag +protected net.minecraft.client.gui.FontRenderer field_78291_n #red +protected net.minecraft.client.gui.FontRenderer field_78292_o #blue +protected net.minecraft.client.gui.FontRenderer field_78306_p #green +protected net.minecraft.client.gui.FontRenderer field_78305_q #alpha +protected net.minecraft.client.gui.FontRenderer field_78304_r #textColor +protected net.minecraft.client.gui.FontRenderer field_78303_s #randomStyle +protected net.minecraft.client.gui.FontRenderer field_78302_t #boldStyle +protected net.minecraft.client.gui.FontRenderer field_78301_u #italicStyle +protected net.minecraft.client.gui.FontRenderer field_78300_v #underlineStyle +protected net.minecraft.client.gui.FontRenderer field_78299_w #strikethroughStyle diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index f69f250e78..7924545051 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -948,8 +948,266 @@ tt.keyword.Chaos=Chaos tt.keyword.Primal=Primal tt.keyword.Aspect=Aspect - - - - - +tt.element.Neutronium=Neutronium +tt.element.Hydrogen=Hydrogen +tt.element.Helium=Helium +tt.element.Lithium=Lithium +tt.element.Beryllium=Beryllium +tt.element.Boron=Boron +tt.element.Carbon=Carbon +tt.element.Nitrogen=Nitrogen +tt.element.Oxygen=Oxygen +tt.element.Fluorine=Fluorine +tt.element.Neon=Neon +tt.element.Sodium=Sodium +tt.element.Magnesium=Magnesium +tt.element.Aluminium=Aluminium +tt.element.Silicon=Silicon +tt.element.Phosphorus=Phosphorus +tt.element.Sulfur=Sulfur +tt.element.Chlorine=Chlorine +tt.element.Argon=Argon +tt.element.Potassium=Potassium +tt.element.Calcium=Calcium +tt.element.Scandium=Scandium +tt.element.Titanium=Titanium +tt.element.Vanadium=Vanadium +tt.element.Chromium=Chromium +tt.element.Manganese=Manganese +tt.element.Iron=Iron +tt.element.Cobalt=Cobalt +tt.element.Nickel=Nickel +tt.element.Copper=Copper +tt.element.Zinc=Zinc +tt.element.Gallium=Gallium +tt.element.Germanium=Germanium +tt.element.Arsenic=Arsenic +tt.element.Selenium=Selenium +tt.element.Bromine=Bromine +tt.element.Krypton=Krypton +tt.element.Rubidium=Rubidium +tt.element.Strontium=Strontium +tt.element.Yttrium=Yttrium +tt.element.Zirconium=Zirconium +tt.element.Niobium=Niobium +tt.element.Molybdenum=Molybdenum +tt.element.Technetium=Technetium +tt.element.Ruthenium=Ruthenium +tt.element.Rhodium=Rhodium +tt.element.Palladium=Palladium +tt.element.Silver=Silver +tt.element.Cadmium=Cadmium +tt.element.Indium=Indium +tt.element.Tin=Tin +tt.element.Antimony=Antimony +tt.element.Tellurium=Tellurium +tt.element.Iodine=Iodine +tt.element.Xenon=Xenon +tt.element.Caesium=Caesium +tt.element.Barium=Barium +tt.element.Lanthanum=Lanthanum +tt.element.Cerium=Cerium +tt.element.Praseodymium=Praseodymium +tt.element.Neodymium=Neodymium +tt.element.Promethium=Promethium +tt.element.Samarium=Samarium +tt.element.Europium=Europium +tt.element.Gadolinium=Gadolinium +tt.element.Terbium=Terbium +tt.element.Dysprosium=Dysprosium +tt.element.Holmium=Holmium +tt.element.Erbium=Erbium +tt.element.Thulium=Thulium +tt.element.Ytterbium=Ytterbium +tt.element.Lutetium=Lutetium +tt.element.Hafnium=Hafnium +tt.element.Tantalum=Tantalum +tt.element.Tungsten=Tungsten +tt.element.Rhenium=Rhenium +tt.element.Osmium=Osmium +tt.element.Iridium=Iridium +tt.element.Platinum=Platinum +tt.element.Gold=Gold +tt.element.Mercury=Mercury +tt.element.Thallium=Thallium +tt.element.Lead=Lead +tt.element.Bismuth=Bismuth +tt.element.Polonium=Polonium +tt.element.Astatine=Astatine +tt.element.Radon=Radon +tt.element.Francium=Francium +tt.element.Radium=Radium +tt.element.Actinium=Actinium +tt.element.Thorium=Thorium +tt.element.Protactinium=Protactinium +tt.element.Uranium=Uranium +tt.element.Neptunium=Neptunium +tt.element.Plutonium=Plutonium +tt.element.Americium=Americium +tt.element.Curium=Curium +tt.element.Berkelium=Berkelium +tt.element.Californium=Californium +tt.element.Einsteinium=Einsteinium +tt.element.Fermium=Fermium +tt.element.Mendelevium=Mendelevium +tt.element.Nobelium=Nobelium +tt.element.Lawrencium=Lawrencium +tt.element.Rutherfordium=Rutherfordium +tt.element.Dubnium=Dubnium +tt.element.Seaborgium=Seaborgium +tt.element.Bohrium=Bohrium +tt.element.Hassium=Hassium +tt.element.Meitnerium=Meitnerium +tt.element.Darmstadtium=Darmstadtium +tt.element.Roentgenium=Roentgenium +tt.element.Copernicium=Copernicium +tt.element.Nihonium=Nihonium +tt.element.Flerovium=Flerovium +tt.element.Moscovium=Moscovium +tt.element.Livermorium=Livermorium +tt.element.Tennessine=Tennessine +tt.element.Oganesson=Oganesson + +tt.element.AntiNeutronium=Antineutronium +tt.element.AntiHydrogen=Antihydrogen +tt.element.AntiHelium=Antihelium +tt.element.AntiLithium=Antilithium +tt.element.AntiBeryllium=Antiberyllium +tt.element.AntiBoron=Antiboron +tt.element.AntiCarbon=Anticarbon +tt.element.AntiNitrogen=Antinitrogen +tt.element.AntiOxygen=Antioxygen +tt.element.AntiFluorine=Antifluorine +tt.element.AntiNeon=Antineon +tt.element.AntiSodium=Antisodium +tt.element.AntiMagnesium=Antimagnesium +tt.element.AntiAluminium=Antialuminium +tt.element.AntiSilicon=Antisilicon +tt.element.AntiPhosphorus=Antiphosphorus +tt.element.AntiSulfur=Antisulfur +tt.element.AntiChlorine=Antichlorine +tt.element.AntiArgon=Antiargon +tt.element.AntiPotassium=Antipotassium +tt.element.AntiCalcium=Anticalcium +tt.element.AntiScandium=Antiscandium +tt.element.AntiTitanium=Antititanium +tt.element.AntiVanadium=Antivanadium +tt.element.AntiChromium=Antichromium +tt.element.AntiManganese=Antimanganese +tt.element.AntiIron=Antiiron +tt.element.AntiCobalt=Anticobalt +tt.element.AntiNickel=Antinickel +tt.element.AntiCopper=Anticopper +tt.element.AntiZinc=Antizinc +tt.element.AntiGallium=Antigallium +tt.element.AntiGermanium=Antigermanium +tt.element.AntiArsenic=Antiarsenic +tt.element.AntiSelenium=Antiselenium +tt.element.AntiBromine=Antibromine +tt.element.AntiKrypton=Antikrypton +tt.element.AntiRubidium=Antirubidium +tt.element.AntiStrontium=Antistrontium +tt.element.AntiYttrium=Antiyttrium +tt.element.AntiZirconium=Antizirconium +tt.element.AntiNiobium=Antiniobium +tt.element.AntiMolybdenum=Antimolybdenum +tt.element.AntiTechnetium=Antitechnetium +tt.element.AntiRuthenium=Antiruthenium +tt.element.AntiRhodium=Antirhodium +tt.element.AntiPalladium=Antipalladium +tt.element.AntiSilver=Antisilver +tt.element.AntiCadmium=Anticadmium +tt.element.AntiIndium=Antiindium +tt.element.AntiTin=Antitin +tt.element.AntiAntimony=Antiantimony +tt.element.AntiTellurium=Antitellurium +tt.element.AntiIodine=Antiiodine +tt.element.AntiXenon=Antixenon +tt.element.AntiCaesium=Anticaesium +tt.element.AntiBarium=Antibarium +tt.element.AntiLanthanum=Antilanthanum +tt.element.AntiCerium=Anticerium +tt.element.AntiPraseodymium=Antipraseodymium +tt.element.AntiNeodymium=Antineodymium +tt.element.AntiPromethium=Antipromethium +tt.element.AntiSamarium=Antisamarium +tt.element.AntiEuropium=Antieuropium +tt.element.AntiGadolinium=Antigadolinium +tt.element.AntiTerbium=Antiterbium +tt.element.AntiDysprosium=Antidysprosium +tt.element.AntiHolmium=Antiholmium +tt.element.AntiErbium=Antierbium +tt.element.AntiThulium=Antithulium +tt.element.AntiYtterbium=Antiytterbium +tt.element.AntiLutetium=Antilutetium +tt.element.AntiHafnium=Antihafnium +tt.element.AntiTantalum=Antitantalum +tt.element.AntiTungsten=Antitungsten +tt.element.AntiRhenium=Antirhenium +tt.element.AntiOsmium=Antiosmium +tt.element.AntiIridium=Antiiridium +tt.element.AntiPlatinum=Antiplatinum +tt.element.AntiGold=Antigold +tt.element.AntiMercury=Antimercury +tt.element.AntiThallium=Antithallium +tt.element.AntiLead=Antilead +tt.element.AntiBismuth=Antibismuth +tt.element.AntiPolonium=Antipolonium +tt.element.AntiAstatine=Antiastatine +tt.element.AntiRadon=Antiradon +tt.element.AntiFrancium=Antifrancium +tt.element.AntiRadium=Antiradium +tt.element.AntiActinium=Antiactinium +tt.element.AntiThorium=Antithorium +tt.element.AntiProtactinium=Antiprotactinium +tt.element.AntiUranium=Antiuranium +tt.element.AntiNeptunium=Antineptunium +tt.element.AntiPlutonium=Antiplutonium +tt.element.AntiAmericium=Antiamericium +tt.element.AntiCurium=Anticurium +tt.element.AntiBerkelium=Antiberkelium +tt.element.AntiCalifornium=Antibalifornium +tt.element.AntiEinsteinium=Antieinsteinium +tt.element.AntiFermium=Antifermium +tt.element.AntiMendelevium=Antimendelevium +tt.element.AntiNobelium=Antinobelium +tt.element.AntiLawrencium=Antilawrencium +tt.element.AntiRutherfordium=Antirutherfordium +tt.element.AntiDubnium=Antidubnium +tt.element.AntiSeaborgium=Antiseaborgium +tt.element.AntiBohrium=Antibohrium +tt.element.AntiHassium=Antihassium +tt.element.AntiMeitnerium=Antimeitnerium +tt.element.AntiDarmstadtium=Antidarmstadtium +tt.element.AntiRoentgenium=Antiroentgenium +tt.element.AntiCopernicium=Anticopernicium +tt.element.AntiNihonium=Antinihonium +tt.element.AntiFlerovium=Antiflerovium +tt.element.AntiMoscovium=Antimoscovium +tt.element.AntiLivermorium=Antilivermorium +tt.element.AntiTennessine=Antitennessine +tt.element.AntiOganesson=Antioganesson + +tt.IUPAC.n=nil +tt.IUPAC.u=un +tt.IUPAC.b=bi +tt.IUPAC.t=tri +tt.IUPAC.q=quad +tt.IUPAC.p=pent +tt.IUPAC.h=hex +tt.IUPAC.s=sept +tt.IUPAC.o=oct +tt.IUPAC.e=enn +tt.IUPAC.N=Nil +tt.IUPAC.U=Un +tt.IUPAC.B=Bi +tt.IUPAC.T=Tri +tt.IUPAC.Q=Quad +tt.IUPAC.P=Pent +tt.IUPAC.H=Hex +tt.IUPAC.S=Sept +tt.IUPAC.O=Oct +tt.IUPAC.E=Enn +tt.IUPAC.ium=ium +tt.IUPAC.Anti=Anti +tt.keyword.Weird=* \ No newline at end of file -- cgit From 9c10b4c63b9c4ea551719c8a059d36ea01c5b89e Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 6 Feb 2022 11:08:29 +0100 Subject: Update TT_Utility --- .../dreamcraft/NoDreamCraftMachineLoader.java | 34 +- .../definitions/EMComplexAspectDefinition.java | 16 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 10 +- .../tectech/mechanics/commands/ConvertFloat.java | 4 +- .../tectech/mechanics/commands/ConvertInteger.java | 4 +- .../tectech/mechanics/data/ChunkDataMessage.java | 4 +- .../tectech/mechanics/data/PlayerPersistence.java | 6 +- .../elementalMatter/core/commands/EMList.java | 4 +- .../core/definitions/EMPrimitiveTemplate.java | 2 +- .../core/maps/EMInstanceStackMap.java | 20 +- .../elementalMatter/core/maps/EMStackMap.java | 13 +- .../elementalMatter/core/maps/IEMMapRead.java | 2 +- .../core/stacks/EMInstanceStack.java | 20 +- .../definitions/complex/EMAtomDefinition.java | 18 +- .../definitions/complex/EMHadronDefinition.java | 16 +- .../definitions/complex/EMNuclideIAEA.java | 2 +- .../tectech/nei/TT_NEI_ResearchHandler.java | 4 +- .../technus/tectech/nei/TT_NEI_ScannerHandler.java | 4 +- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 3 +- .../item/DebugElementalInstanceContainer_EM.java | 6 +- .../item/ElementalDefinitionContainer_EM.java | 6 +- .../item/ElementalDefinitionScanStorage_EM.java | 6 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 6 +- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 6 +- .../GT_MetaTileEntity_Hatch_CreativeData.java | 4 +- ...T_MetaTileEntity_Hatch_CreativeMaintenance.java | 4 +- .../GT_MetaTileEntity_Hatch_DataConnector.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java | 4 +- .../GT_MetaTileEntity_Hatch_DynamoTunnel.java | 4 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 9 +- .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 6 +- .../GT_MetaTileEntity_Hatch_EnergyTunnel.java | 8 +- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_InputData.java | 4 +- .../GT_MetaTileEntity_Hatch_InputDataItems.java | 4 +- .../GT_MetaTileEntity_Hatch_InputElemental.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_OutputData.java | 4 +- .../GT_MetaTileEntity_Hatch_OutputDataItems.java | 4 +- .../GT_MetaTileEntity_Hatch_OutputElemental.java | 4 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 15 +- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 4 +- .../hatch/GT_MetaTileEntity_Hatch_Rack.java | 6 +- .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 4 +- .../hatch/TextParametersMessage.java | 6 +- .../hatch/gui/GT_Container_Param.java | 22 +- .../hatch/gui/GT_Container_ParamAdv.java | 26 +- .../hatch/gui/GT_Container_ParamText.java | 22 +- .../hatch/gui/GT_GUIContainer_Param.java | 17 +- .../hatch/gui/GT_GUIContainer_ParamAdv.java | 17 +- .../hatch/gui/GT_GUIContainer_ParamText.java | 20 +- .../multi/GT_MetaTileEntity_EM_computer.java | 4 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 2 +- .../multi/base/GT_Container_MultiMachineEM.java | 10 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 8 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 10 +- .../single/GT_MetaTileEntity_BuckConverter.java | 6 +- .../single/GT_MetaTileEntity_DataReader.java | 22 +- .../single/GT_MetaTileEntity_DebugPollutor.java | 6 +- .../GT_MetaTileEntity_DebugPowerGenerator.java | 6 +- .../GT_MetaTileEntity_DebugStructureWriter.java | 10 +- .../single/GT_MetaTileEntity_MicroController.java | 6 +- .../single/GT_MetaTileEntity_OwnerDetector.java | 6 +- .../single/GT_MetaTileEntity_TT_Transformer.java | 6 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 5 +- .../single/gui/GT_Container_DebugPollutor.java | 10 +- .../single/gui/GT_GUIContainer_BuckConverter.java | 4 +- .../single/gui/GT_GUIContainer_DataReader.java | 9 +- .../gui/GT_GUIContainer_DebugPowerGenerator.java | 4 +- .../github/technus/tectech/util/TT_Utility.java | 613 +++++++++++++++++++++ .../java/com/github/technus/tectech/util/Util.java | 596 -------------------- src/main/resources/assets/tectech/lang/en_US.lang | 3 + 72 files changed, 899 insertions(+), 895 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/util/TT_Utility.java delete mode 100644 src/main/java/com/github/technus/tectech/util/Util.java (limited to 'src/main/resources/assets/tectech/lang/en_US.lang') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java index 798ffec36c..c8eda64bea 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.compatibility.dreamcraft; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TT_Transformer; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_WetTransformer; @@ -105,7 +105,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11230, "hull.tier.10", "UEV Machine Hull", 10, imagination); - Util.setTier(10, temp); + TT_Utility.setTier(10, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -114,7 +114,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11231, "hull.tier.11", "UIV Machine Hull", 11, imagination); - Util.setTier(11, temp); + TT_Utility.setTier(11, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -123,7 +123,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11232, "hull.tier.12", "UMV Machine Hull", 12, imagination); - Util.setTier(12, temp); + TT_Utility.setTier(12, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -132,7 +132,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11233, "hull.tier.13", "UXV Machine Hull", 13, imagination); - Util.setTier(13, temp); + TT_Utility.setTier(13, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -141,7 +141,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11234, "hull.tier.14", "OPV Machine Hull", 14, imagination); - Util.setTier(14, temp); + TT_Utility.setTier(14, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -150,7 +150,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_BasicHull( 11235, "hull.tier.15", "MAX Machine Hull", 15, imagination); - Util.setTier(15, temp); + TT_Utility.setTier(15, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -162,7 +162,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_TT_Transformer( 11221, "tt.transformer.tier.10", "Extremely Ultimate Transformer", 10);//UIV -> UEV (Use Soft Mallet to invert) - Util.setTier(10, temp); + TT_Utility.setTier(10, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -170,7 +170,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_TT_Transformer( 11222, "tt.transformer.tier.11", "Insanely Ultimate Transformer", 11);//UMV -> UIV (Use Soft Mallet to invert) - Util.setTier(11, temp); + TT_Utility.setTier(11, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -178,7 +178,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_TT_Transformer( 11223, "tt.transformer.tier.12", "Mega Ultimate Transformer", 12);//UXV -> UMV (Use Soft Mallet to invert) - Util.setTier(12, temp); + TT_Utility.setTier(12, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -186,7 +186,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_TT_Transformer( 11224, "tt.transformer.tier.13", "Extended Mega Ultimate Transformer", 13);//OPV -> UXV (Use Soft Mallet to invert) - Util.setTier(13, temp); + TT_Utility.setTier(13, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -194,7 +194,7 @@ public class NoDreamCraftMachineLoader implements Runnable { temp = new GT_MetaTileEntity_TT_Transformer( 11225, "tt.transformer.tier.14", "Overpowered Transformer", 14);//MAX -> OPV (Use Soft Mallet to invert) - Util.setTier(14, temp); + TT_Utility.setTier(14, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -215,7 +215,7 @@ public class NoDreamCraftMachineLoader implements Runnable { 11910, "transformer.ha.tier.10", "Extremely Ultimate Hi-Amp Transformer", 10, //UIV -> UEV (Use Soft Mallet to invert) translateToLocal("gt.blockmachines.transformer.ha.tier.10.desc")); - Util.setTier(10, temp); + TT_Utility.setTier(10, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -225,7 +225,7 @@ public class NoDreamCraftMachineLoader implements Runnable { 11911, "transformer.ha.tier.11", "Insanely Ultimate Hi-Amp Transformer", 11, //UMV -> UIV (Use Soft Mallet to invert) translateToLocal("gt.blockmachines.transformer.ha.tier.11.desc")); - Util.setTier(11, temp); + TT_Utility.setTier(11, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -235,7 +235,7 @@ public class NoDreamCraftMachineLoader implements Runnable { 11912, "transformer.ha.tier.12", "Mega Ultimate Hi-Amp Transformer", 12, //UXV -> UMV (Use Soft Mallet to invert) translateToLocal("gt.blockmachines.transformer.ha.tier.12.desc")); - Util.setTier(12, temp); + TT_Utility.setTier(12, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -245,7 +245,7 @@ public class NoDreamCraftMachineLoader implements Runnable { 11913, "transformer.ha.tier.13", "Extended Mega Ultimate Hi-Amp Transformer", 13, //OPV -> UXV (Use Soft Mallet to invert) translateToLocal("gt.blockmachines.transformer.ha.tier.13.desc")); - Util.setTier(13, temp); + TT_Utility.setTier(13, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } @@ -255,7 +255,7 @@ public class NoDreamCraftMachineLoader implements Runnable { 11914, "transformer.ha.tier.14", "Overpowered Hi-Amp Transformer", 14, //MAX -> OPV (Use Soft Mallet to invert) translateToLocal("gt.blockmachines.transformer.ha.tier.14.desc")); - Util.setTier(14, temp); + TT_Utility.setTier(14, temp); if (GT_Values.GT.isClientSide()) { field.set(temp, method.invoke(temp, iTexture)); } 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 8c90dc939c..be1ed9bd51 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 @@ -10,7 +10,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.reg 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.Util; +import com.github.technus.tectech.util.TT_Utility; import java.util.ArrayList; @@ -233,30 +233,30 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { @Override public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { lines.add(getShortSymbol()); } } @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType()); } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { + 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 (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); } - if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + 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/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java index a61490b162..bd25b05a0c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.IChunkMetaDataHandler; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -33,8 +33,8 @@ import java.util.Map; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; -import static com.github.technus.tectech.util.Util.crossProduct3D; -import static com.github.technus.tectech.util.Util.normalize3D; +import static com.github.technus.tectech.util.TT_Utility.crossProduct3D; +import static com.github.technus.tectech.util.TT_Utility.normalize3D; public class AnomalyHandler implements IChunkMetaDataHandler { private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;//can be const as it is computed later... @@ -171,8 +171,8 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } int x = (b.xPosition - a.xPosition) << 4; int z = (b.xPosition - a.xPosition) << 4; - List aE = a.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(a)); - List bE = b.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(b)); + List aE = a.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TT_Utility.fromChunk(a)); + List bE = b.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, TT_Utility.fromChunk(b)); for (EntityLivingBase entityLivingBase : aE) { if (TecTech.RANDOM.nextBoolean()) { if (entityLivingBase instanceof EntityPlayer) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java index 5885226f6f..ff515ab7d3 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java +++ b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.commands; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -25,7 +25,7 @@ public class ConvertFloat implements ICommand { float value=Float.parseFloat(args[0]); sender.addChatMessage(new ChatComponentText( EnumChatFormatting.AQUA.toString()+ EnumChatFormatting.BOLD + - Util.intBitsToShortString(Float.floatToIntBits(value))+" "+ + TT_Utility.intBitsToShortString(Float.floatToIntBits(value))+" "+ EnumChatFormatting.RESET+EnumChatFormatting.BLUE +value)); }catch (Exception e){ sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Invalid Float "+args[0])); diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java index 41edd66684..37651e7478 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java +++ b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.commands; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -25,7 +25,7 @@ public class ConvertInteger implements ICommand { int value=Integer.parseInt(args[0]); sender.addChatMessage(new ChatComponentText( EnumChatFormatting.AQUA.toString()+ EnumChatFormatting.BOLD + - Util.intBitsToShortString(value)+" "+ + TT_Utility.intBitsToShortString(value)+" "+ EnumChatFormatting.RESET+EnumChatFormatting.BLUE +value)); }catch (Exception e){ sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Invalid Integer "+args[0])); diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java index 6094d08ba4..216c4057ef 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.data; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -80,7 +80,7 @@ public class ChunkDataMessage implements IMessage { public static class ClientHandler extends AbstractClientMessageHandler { @Override public IMessage handleClientMessage(EntityPlayer pPlayer, ChunkDataData pMessage, MessageContext pCtx) { - if(Util.checkChunkExist(pPlayer.worldObj,pMessage.chunk)){ + if(TT_Utility.checkChunkExist(pPlayer.worldObj,pMessage.chunk)){ TecTech.chunkDataHandler.putChunkData(pMessage.handler, pMessage.worldId,pMessage.chunk, pMessage.data); } return null; diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java index f69bccc871..beda03fe0a 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java +++ b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.data; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; @@ -32,7 +32,7 @@ public class PlayerPersistence { if(tag!=null){ return tag; } - tag=Util.getPlayerData(uuid1,uuid2,extension); + tag= TT_Utility.getPlayerData(uuid1,uuid2,extension); if(tag==null){ tag=new NBTTagCompound(); } @@ -58,7 +58,7 @@ public class PlayerPersistence { } public void saveData(EntityPlayer player){ - Util.savePlayerFile(player,extension,getDataOrSetToNewTag(player)); + TT_Utility.savePlayerFile(player,extension,getDataOrSetToNewTag(player)); } @SubscribeEvent diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java index fe542abbde..0f71a24d82 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.commands; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -28,7 +28,7 @@ public class EMList implements ICommand { if(args.length == 0) { listClasses(sender); }else { - String concated = Util.getConcated(args, " "); + String concated = TT_Utility.getConcated(args, " "); listDefinitions(sender,concated, concated.replaceAll(" ","_"),concated.replaceAll("_"," ")); } } 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 a1f606c3c2..edf1827a07 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 @@ -9,7 +9,7 @@ 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.Util.areBitsSet; +import static com.github.technus.tectech.util.TT_Utility.areBitsSet; import static net.minecraft.util.StatCollector.translateToLocal; /** 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 265d219168..bfaad77c33 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 @@ -7,6 +7,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.reg import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.util.TT_Utility; +import gregtech.api.util.GT_Utility; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -94,9 +96,9 @@ public final class EMInstanceStackMap extends EMStackMap implem for (EMInstanceStack instance : getBackingMap().values()) { info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+ " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+ - " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() /AVOGADRO_CONSTANT) +" "+translateToLocal("tt.keyword.mol")+ EnumChatFormatting.RESET+ - " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ - " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + " #: " + 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())); } return info; } @@ -165,17 +167,6 @@ public final class EMInstanceStackMap extends EMStackMap implem return new EMInstanceStackMap(false, instances); } - @Override - public boolean equals(Object obj) { - if (obj instanceof EMInstanceStackMap) { - return compareTo((EMInstanceStackMap) obj) == 0; - } - if (obj instanceof EMStackMap) { - return toDefinitionMapForComparison().compareTo((EMStackMap) obj) == 0; - } - return false; - } - @Override public String toString() { StringBuilder build=new StringBuilder("Instance Stack Map\n"); @@ -197,6 +188,7 @@ public final class EMInstanceStackMap extends EMStackMap implem return newStack; } + @Deprecated public EMDefinitionStackMap toDefinitionMapForComparison() { EMDefinitionStack[] list = new EMDefinitionStack[size()]; int i = 0; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java index 795ac3d3bf..3765fe6098 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java @@ -30,11 +30,11 @@ abstract class EMStackMap implements IEMMapRead { @Override public boolean equals(Object obj) { - if (obj instanceof EMInstanceStackMap) { - return compareTo(((EMInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + if(this == obj){ + return true; } - if (obj instanceof EMStackMap) { - return compareTo((EMStackMap) obj) == 0; + if (obj instanceof IEMMapRead) { + return compareTo((IEMMapRead) obj) == 0; } return false; } @@ -47,4 +47,9 @@ abstract class EMStackMap implements IEMMapRead { } return hash; } + + @Override + public int compareTo(IEMMapRead o) { + return IEMMapRead.super.compareTo(o); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java index c0420fa2b2..86ca6de8a8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -14,7 +14,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.transfor import static com.github.technus.tectech.util.DoubleCount.ulpSigned; import static net.minecraft.util.StatCollector.translateToLocal; -public interface IEMMapRead extends Comparable>, Cloneable { +public interface IEMMapRead extends Comparable>, Cloneable { NavigableMap getBackingMap(); IEMMapRead clone(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java index b67d2ce121..d37a8bd099 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java @@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEM 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.maps.EMInstanceStackMap; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; @@ -505,26 +505,26 @@ public final class EMInstanceStack implements IEMStack { public void addScanResults(ArrayList lines, int[] detailsOnDepthLevels) { int capabilities = detailsOnDepthLevels[0]; - if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { lines.add("DEPTH = " + 0); } getDefinition().addScanResults(lines, capabilities, energy); - if (Util.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { lines.add("TIME MULT = " + lifeTimeMult); - if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("TIME SPAN = " + lifeTime + " s"); } } - if (Util.areBitsSet(SCAN_GET_AGE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_AGE, capabilities)) { lines.add("AGE = " + getAge() + " s"); } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { lines.add("COLOR = " + color + " RGB or CMY"); } - if (Util.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { lines.add("ENERGY = " + energy); } - if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")); } scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); @@ -535,11 +535,11 @@ public final class EMInstanceStack implements IEMStack { int deeper = depth + 1; for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { lines.add("");//def separator - if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) { + if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) { lines.add("DEPTH = " + depth); } getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy); - if (Util.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) { + if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) { lines.add("AMOUNT = " + definitionStack.getAmount()); } scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java index 0eced7bd3c..20e58216c1 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -14,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.util.XSTR; import java.util.*; @@ -1676,35 +1676,35 @@ public class EMAtomDefinition extends EMComplexTemplate { @Override public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add(getShortSymbol()); } } @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = " + getLocalizedName()); lines.add("SYMBOL = " + getSymbol()); } - if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if (iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { + if (iaeaDefinitionExistsAndHasEnergyLevels && TT_Utility.areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { for (int i = 1; i < getIaea().getEnergeticStatesArray().length; i++) { lines.add("E LEVEL " + i + " = " + getIaea().getEnergeticStatesArray()[i].energy + " eV"); } } - if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("HALF LIFE = " + getRawTimeSpan(energyLevel) + " s"); lines.add(" At current energy level"); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java index 19208fbf4a..85cb07ea33 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java @@ -15,7 +15,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.oredict.OreDictionary; @@ -461,30 +461,30 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i @Override public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add(getShortSymbol()); } } @Override public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = " + getLocalizedTypeName()); //lines.add("SYMBOL = "+getSymbol()); } - if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) { lines.add("CHARGE = " + getCharge() / 3D + " e"); } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) { lines.add("MASS = " + getMass() + " eV/c\u00b2"); } - if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("HALF LIFE = " + getRawTimeSpan(energyLevel) + " s"); lines.add(" " + "At current energy level"); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java index bd34733cb6..e5fab5e6bf 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java @@ -8,7 +8,7 @@ import java.util.HashSet; import java.util.TreeMap; import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.util.Util.splitButDifferent; +import static com.github.technus.tectech.util.TT_Utility.splitButDifferent; public final class EMNuclideIAEA { public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java index 114dc7399f..85e9fa26ec 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java @@ -215,8 +215,8 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { int tSpecial = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; short ampere=(short) (tSpecial & 0xFFFF),minComputationPerSec=(short)(tSpecial>>>16); if (tEUt != 0) { - drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20) + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long)tEUt*ampere) + " EU/t", -16777216); + drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1 + (computation - minComputationPerSec) / minComputationPerSec) * (long) tEUt * ampere * 20) + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long) tEUt * ampere) + " EU/t", -16777216); if (mRecipeMap.mShowVoltageAmperageInNEI) { drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java index 2dc4604fd5..50035be554 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java @@ -215,8 +215,8 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { int tSpecial = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; short ampere=(short) (tSpecial & 0xFFFF),minComputationPerSec=(short)(tSpecial>>>16); if (tEUt != 0) { - drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20) + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long)tEUt*ampere) + " EU/t", -16777216); + drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1 + (computation - minComputationPerSec) / minComputationPerSec) * (long) tEUt * ampere * 20) + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long) tEUt * ampere) + " EU/t", -16777216); if (mRecipeMap.mShowVoltageAmperageInNEI) { drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(ampere), -16777216); diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java index d6b5e28b18..7266611b20 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.cover; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage; import com.github.technus.tectech.mechanics.enderStorage.EnderLinkTag; +import com.github.technus.tectech.util.TT_Utility; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; import gregtech.api.enums.GT_Values; import gregtech.api.gui.GT_GUICover; @@ -325,7 +326,7 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { @Override public void resetTextBox(GT_GuiIntegerTextBox box) { //Solid White becomes: #FFFFFFFF - box.setText("#" + String.format("%08X", tag.getColorInt())); + box.setText("#" + TT_Utility.formatNumberIntHex(tag.getColorInt())); } public void resetColorField() { diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index b8ce40b180..7d7880adca 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -9,7 +9,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -120,7 +120,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { aList.add(translateToLocal("item.em.debugContainer.desc.0") + ": ");//Contains - Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); + Collections.addAll(aList, TT_Utility.infoFromNBT(tNBT.getCompoundTag("info"))); } else { aList.add(translateToLocal("item.em.debugContainer.desc.1"));//Container for elemental matter aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.debugContainer.desc.2"));//Right click on elemental hatches @@ -155,7 +155,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings=Util.infoFromNBT(tNBT.getCompoundTag("symbols")); + String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); return strings[index%strings.length]; } else { return null; diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index 0de8bb007a..dede2e36ce 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -6,7 +6,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; @@ -114,7 +114,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { aList.add(translateToLocal("item.em.definitionContainer.desc.0") + ": ");//Should Contain - Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); + Collections.addAll(aList, TT_Utility.infoFromNBT(tNBT.getCompoundTag("info"))); } else { aList.add(translateToLocal("item.em.definitionContainer.desc.1"));//Recipe Hint } @@ -140,7 +140,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings=Util.infoFromNBT(tNBT.getCompoundTag("symbols")); + String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); return strings[index%strings.length]; } else { return null; diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index 1cb6de1df6..22fc6e65a9 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstance import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -65,7 +65,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl public static String[] getLines(ItemStack containerItem){ if(containerItem.stackTagCompound!=null && containerItem.stackTagCompound.hasKey("elementalInfo")) { - return Util.infoFromNBT(containerItem.stackTagCompound.getCompoundTag("elementalInfo")); + return TT_Utility.infoFromNBT(containerItem.stackTagCompound.getCompoundTag("elementalInfo")); } return null; } @@ -142,7 +142,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings=Util.infoFromNBT(tNBT.getCompoundTag("symbols")); + String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); return strings[index%strings.length]; } else { return null; diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index 7f9e0f0a4a..aff84c9b4b 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -146,13 +146,13 @@ public final class ParametrizerMemoryCard extends Item { aList.add("Hatch ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); temp=tNBT.getInteger("value0D"); aList.add("Value 0D: "+EnumChatFormatting.AQUA + temp); - aList.add("Value 0B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp))); + aList.add("Value 0B: "+EnumChatFormatting.AQUA + TT_Utility.longBitsToShortString(Double.doubleToLongBits(temp))); if(tNBT.hasKey("value0s")) { aList.add("Value 0s: " + EnumChatFormatting.AQUA + tNBT.getString("value0s")); } temp=tNBT.getInteger("value1D"); aList.add("Value 1D: "+EnumChatFormatting.AQUA + temp); - aList.add("Value 1B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp))); + aList.add("Value 1B: "+EnumChatFormatting.AQUA + TT_Utility.longBitsToShortString(Double.doubleToLongBits(temp))); if(tNBT.hasKey("value1s")) { aList.add("Value 1s: " + EnumChatFormatting.AQUA + tNBT.getString("value1s")); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index 4e07622c25..1e90535224 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Capacitor; import cpw.mods.fml.relauncher.Side; @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.getUniqueIdentifier; +import static com.github.technus.tectech.util.TT_Utility.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static net.minecraft.util.StatCollector.translateToLocal; @@ -38,7 +38,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 16, ""); - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java index 815f8006c4..eb9ce2af30 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; @@ -22,7 +22,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Hatch_CreativeData extends GT_MetaTileEntity_Hatch_DataConnector { public GT_MetaTileEntity_Hatch_CreativeData(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_CreativeData(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java index 42817f473e..5279da2b00 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -22,7 +22,7 @@ public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEnti public GT_MetaTileEntity_Hatch_CreativeMaintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_CreativeMaintenance(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java index 4aa90339cc..3385447861 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.mechanics.dataTransport.DataPacket; import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import cpw.mods.fml.relauncher.Side; @@ -41,7 +41,7 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector { public GT_MetaTileEntity_Hatch_OutputData(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_OutputData(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java index 385de4343c..5fe3fd3170 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; @@ -21,7 +21,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_Hatch_DataConnector { public GT_MetaTileEntity_Hatch_OutputDataItems(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_OutputDataItems(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java index 1426e8a702..4b62965dba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -16,7 +16,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { public GT_MetaTileEntity_Hatch_OutputElemental(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, translateToLocal("gt.blockmachines.emout.desc"));//Elemental Output for Multiblocks - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } //public GT_MetaTileEntity_Hatch_OutputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java index 8b55c16831..5223ca5b5b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -12,7 +12,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -54,7 +53,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity overflowMatter = max / 2; overflowMax = max; overflowDisperse = overflowMax / (float) (30 - aTier); - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, double max, String aDescription, ITexture[][][] aTextures) { @@ -89,8 +88,8 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity return new String[]{ CommonValues.TEC_MARK_EM, mDescription, - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(overflowMax) + " eV/c\u00b2", - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(overflowDisperse) + " (eV/c\u00b2)/s", + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowMax) + " eV/c\u00b2", + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowDisperse) + " (eV/c\u00b2)/s", translateToLocal("gt.blockmachines.hatch.emmuffler.desc.3") }; } @@ -218,10 +217,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity public String[] getInfoData() { return new String[]{ translateToLocalFormatted("tt.keyphrase.Contained_mass", clientLocale) + ":", - EnumChatFormatting.RED + GT_Utility.formatNumbers(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", + EnumChatFormatting.RED + TT_Utility.formatNumberExp(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", + EnumChatFormatting.GREEN + TT_Utility.formatNumberShortExp(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + - EnumChatFormatting.BLUE + GT_Utility.formatNumbers(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + EnumChatFormatting.BLUE + TT_Utility.formatNumberShortExp(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index 7b8a488e57..10e6ca71d9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Param; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamAdv; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Param; @@ -44,7 +44,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_Param(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java index 53fea9ef7c..975d6b516b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Rack; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Rack; import cpw.mods.fml.common.Loader; @@ -29,7 +29,7 @@ import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; -import static com.github.technus.tectech.util.Util.getUniqueIdentifier; +import static com.github.technus.tectech.util.TT_Utility.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -48,7 +48,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 4, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_Hatch_Rack(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java index d723dd908c..00c1d002b6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Uncertainty; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Uncertainty; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_UncertaintyAdv; @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); regenerate(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java index b0b53f6c79..96b54273db 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -149,8 +149,8 @@ public class TextParametersMessage implements IMessage { if(meta instanceof GT_MetaTileEntity_Hatch_ParamText){ ((GT_MetaTileEntity_Hatch_ParamText) meta).value0s =pMessage.mVal0; ((GT_MetaTileEntity_Hatch_ParamText) meta).value1s =pMessage.mVal1; - ((GT_MetaTileEntity_Hatch_ParamText) meta).value0D=Util.getValue(pMessage.mVal0); - ((GT_MetaTileEntity_Hatch_ParamText) meta).value1D=Util.getValue(pMessage.mVal1); + ((GT_MetaTileEntity_Hatch_ParamText) meta).value0D= TT_Utility.getValue(pMessage.mVal0); + ((GT_MetaTileEntity_Hatch_ParamText) meta).value1D= TT_Utility.getValue(pMessage.mVal1); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java index da067078c9..cf3a164f8f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -144,11 +144,11 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - Util.sendInteger(param,this,var1,100); - Util.sendDouble(value0d,this,var1,102); - Util.sendDouble(value1d,this,var1, 106); - Util.sendDouble(input0d,this,var1, 110); - Util.sendDouble(input1d,this,var1, 114); + TT_Utility.sendInteger(param,this,var1,100); + TT_Utility.sendDouble(value0d,this,var1,102); + TT_Utility.sendDouble(value1d,this,var1, 106); + TT_Utility.sendDouble(input0d,this,var1, 110); + TT_Utility.sendDouble(input1d,this,var1, 114); } } @@ -159,31 +159,31 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { switch (par1) { case 100: case 101: - param=Util.receiveInteger(param,100,par1,par2); + param= TT_Utility.receiveInteger(param,100,par1,par2); return; case 102: case 103: case 104: case 105: - value0d =Double.longBitsToDouble(value0l=Util.receiveLong(value0l,102,par1,par2)); + value0d =Double.longBitsToDouble(value0l= TT_Utility.receiveLong(value0l,102,par1,par2)); return; case 106: case 107: case 108: case 109: - value1d =Double.longBitsToDouble(value1l=Util.receiveLong(value1l,106,par1,par2)); + value1d =Double.longBitsToDouble(value1l= TT_Utility.receiveLong(value1l,106,par1,par2)); return; case 110: case 111: case 112: case 113: - input0d =Double.longBitsToDouble(input0l=Util.receiveLong(input0l,110,par1,par2)); + input0d =Double.longBitsToDouble(input0l= TT_Utility.receiveLong(input0l,110,par1,par2)); return; case 114: case 115: case 116: case 117: - input1d =Double.longBitsToDouble(input1l=Util.receiveLong(input1l,114,par1,par2)); + input1d =Double.longBitsToDouble(input1l= TT_Utility.receiveLong(input1l,114,par1,par2)); return; default: } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java index c8fa85996a..75abd6d4c2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -231,12 +231,12 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - Util.sendInteger(param,this,var1,100); - Util.sendDouble(value0d,this,var1,102); - Util.sendDouble(value1d,this,var1, 106); - Util.sendDouble(input0d,this,var1, 110); - Util.sendDouble(input1d,this,var1, 114); - Util.sendInteger(pointer,this,var1,118); + TT_Utility.sendInteger(param,this,var1,100); + TT_Utility.sendDouble(value0d,this,var1,102); + TT_Utility.sendDouble(value1d,this,var1, 106); + TT_Utility.sendDouble(input0d,this,var1, 110); + TT_Utility.sendDouble(input1d,this,var1, 114); + TT_Utility.sendInteger(pointer,this,var1,118); } } @@ -247,35 +247,35 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { switch (par1) { case 100: case 101: - param=Util.receiveInteger(param,100,par1,par2); + param= TT_Utility.receiveInteger(param,100,par1,par2); return; case 102: case 103: case 104: case 105: - value0d =Double.longBitsToDouble(value0l=Util.receiveLong(value0l,102,par1,par2)); + value0d =Double.longBitsToDouble(value0l= TT_Utility.receiveLong(value0l,102,par1,par2)); return; case 106: case 107: case 108: case 109: - value1d =Double.longBitsToDouble(value1l=Util.receiveLong(value1l,106,par1,par2)); + value1d =Double.longBitsToDouble(value1l= TT_Utility.receiveLong(value1l,106,par1,par2)); return; case 110: case 111: case 112: case 113: - input0d =Double.longBitsToDouble(input0l=Util.receiveLong(input0l,110,par1,par2)); + input0d =Double.longBitsToDouble(input0l= TT_Utility.receiveLong(input0l,110,par1,par2)); return; case 114: case 115: case 116: case 117: - input1d =Double.longBitsToDouble(input1l=Util.receiveLong(input1l,114,par1,par2)); + input1d =Double.longBitsToDouble(input1l= TT_Utility.receiveLong(input1l,114,par1,par2)); return; case 118: case 119: - pointer=Util.receiveInteger(pointer,118,par1,par2); + pointer= TT_Utility.receiveInteger(pointer,118,par1,par2); return; default: } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java index 9c0e08948f..1d2df027f3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; @@ -95,11 +95,11 @@ public class GT_Container_ParamText extends GT_ContainerMetaTile_Machine { input1d = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).input1D; for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - Util.sendInteger(param,this,var1,100); - Util.sendDouble(value0d,this,var1,102); - Util.sendDouble(value1d,this,var1, 106); - Util.sendDouble(input0d,this,var1, 110); - Util.sendDouble(input1d,this,var1, 114); + TT_Utility.sendInteger(param,this,var1,100); + TT_Utility.sendDouble(value0d,this,var1,102); + TT_Utility.sendDouble(value1d,this,var1, 106); + TT_Utility.sendDouble(input0d,this,var1, 110); + TT_Utility.sendDouble(input1d,this,var1, 114); } if(!Objects.equals(value0s,((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0s) || !Objects.equals(value0s,((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0s)){ @@ -123,31 +123,31 @@ public class GT_Container_ParamText extends GT_ContainerMetaTile_Machine { switch (par1) { case 100: case 101: - param=Util.receiveInteger(param,100,par1,par2); + param= TT_Utility.receiveInteger(param,100,par1,par2); return; case 102: case 103: case 104: case 105: - value0d =Double.longBitsToDouble(value0l=Util.receiveLong(value0l,102,par1,par2)); + value0d =Double.longBitsToDouble(value0l= TT_Utility.receiveLong(value0l,102,par1,par2)); return; case 106: case 107: case 108: case 109: - value1d =Double.longBitsToDouble(value1l=Util.receiveLong(value1l,106,par1,par2)); + value1d =Double.longBitsToDouble(value1l= TT_Utility.receiveLong(value1l,106,par1,par2)); return; case 110: case 111: case 112: case 113: - input0d =Double.longBitsToDouble(input0l=Util.receiveLong(input0l,110,par1,par2)); + input0d =Double.longBitsToDouble(input0l= TT_Utility.receiveLong(input0l,110,par1,par2)); return; case 114: case 115: case 116: case 117: - input1d =Double.longBitsToDouble(input1l=Util.receiveLong(input1l,114,par1,par2)); + input1d =Double.longBitsToDouble(input1l= TT_Utility.receiveLong(input1l,114,par1,par2)); return; default: } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index 7eb71651bb..686c2c81ce 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -1,14 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import org.lwjgl.opengl.GL11; -import java.util.Locale; - import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { @@ -20,15 +18,14 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (mContainer != null) { TecTechFontRender.INSTANCE.drawSplitString("Parameters: " + ((GT_Container_Param) mContainer).param, 46, 7, 167, 0xffffff); - Locale locale= Locale.getDefault(); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).input0d), 46, 16, 167, 0x22ddff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).input1d), 46, 24, 167, 0x00ffff); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value0d), 46, 33, 167, 0x00bbff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value1d), 46, 41, 167, 0x0077ff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + TT_Utility.formatNumberExp(((GT_Container_Param) mContainer).input0d), 46, 16, 167, 0x22ddff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + TT_Utility.formatNumberExp(((GT_Container_Param) mContainer).input1d), 46, 24, 167, 0x00ffff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + TT_Utility.formatNumberExp(((GT_Container_Param) mContainer).value0d), 46, 33, 167, 0x00bbff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + TT_Utility.formatNumberExp(((GT_Container_Param) mContainer).value1d), 46, 41, 167, 0x0077ff); GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0d)), 92, 100, 334, 0x00bbff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1d)), 92, 116, 334, 0x0077ff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + TT_Utility.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0d)), 92, 100, 334, 0x00bbff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + TT_Utility.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1d)), 92, 116, 334, 0x0077ff); GL11.glPopMatrix(); } else { TecTechFontRender.INSTANCE.drawSplitString("Parameters", 46, 7, 167, 0xffffff); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java index 4346118619..f7ffa18ffc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -1,14 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import org.lwjgl.opengl.GL11; -import java.util.Locale; - import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { @@ -20,15 +18,14 @@ public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (mContainer != null) { TecTechFontRender.INSTANCE.drawSplitString("Parameters X: " + ((GT_Container_ParamAdv) mContainer).param, 46, 7, 167, 0xffffff); - Locale locale = Locale.getDefault(); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).input0d)), 46, 16, 167, 0x22ddff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).input1d)), 46, 24, 167, 0x00ffff); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value0d)), 46, 33, 167, 0x00bbff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value1d)), 46, 41, 167, 0x0077ff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + TT_Utility.formatNumberExp((((GT_Container_ParamAdv) mContainer).input0d)), 46, 16, 167, 0x22ddff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + TT_Utility.formatNumberExp((((GT_Container_ParamAdv) mContainer).input1d)), 46, 24, 167, 0x00ffff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + TT_Utility.formatNumberExp((((GT_Container_ParamAdv) mContainer).value0d)), 46, 33, 167, 0x00bbff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + TT_Utility.formatNumberExp((((GT_Container_ParamAdv) mContainer).value1d)), 46, 41, 167, 0x0077ff); GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0d)), 92, 100, 334, 0x00bbff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1d)), 92, 116, 334, 0x0077ff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06" + TT_Utility.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0d)), 92, 100, 334, 0x00bbff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06" + TT_Utility.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1d)), 92, 116, 334, 0x0077ff); GL11.glPopMatrix(); TecTechFontRender.INSTANCE.drawSplitString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); } else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java index 50e608294e..e10f30076d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java @@ -1,16 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.InventoryPlayer; -import java.util.Locale; import java.util.Objects; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; @@ -77,11 +76,10 @@ public class GT_GUIContainer_ParamText extends GT_GUIContainerMetaTile_Machine { protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (mContainer != null) { TecTechFontRender.INSTANCE.drawSplitString("Parameters tXt: " + ((GT_Container_ParamText) mContainer).param, 46, 7, 167, 0xffffff); - Locale locale = Locale.getDefault(); TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06", 10, 29, 16, 0x00bbff); TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06", 10, 44, 16, 0x0077ff); - TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamText) mContainer).input0d)), 10, 56, 167, 0x22ddff); - TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamText) mContainer).input1d)), 10, 65, 167, 0x00ffff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + TT_Utility.formatNumberExp((((GT_Container_ParamText) mContainer).input0d)), 10, 56, 167, 0x22ddff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + TT_Utility.formatNumberExp((((GT_Container_ParamText) mContainer).input1d)), 10, 65, 167, 0x00ffff); } else { TecTechFontRender.INSTANCE.drawSplitString("Parameters tXt", 46, 7, 167, 0xffffff); } @@ -107,12 +105,12 @@ public class GT_GUIContainer_ParamText extends GT_GUIContainerMetaTile_Machine { try { if (str.contains("b")) { String[] split = str.split("b"); - val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); + val = TT_Utility.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); } else if (str.contains("x")) { String[] split = str.split("x"); - val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); + val = TT_Utility.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); } else { - val = Util.stringToDouble(str); + val = TT_Utility.stringToDouble(str); } if (!Objects.equals(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value0s, value0tb.getText())) { ((GT_Container_ParamText) mContainer).value0s = value0tb.getText(); @@ -135,12 +133,12 @@ public class GT_GUIContainer_ParamText extends GT_GUIContainerMetaTile_Machine { try { if (str.contains("b")) { String[] split = str.split("b"); - val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); + val = TT_Utility.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); } else if (str.contains("x")) { String[] split = str.split("x"); - val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); + val = TT_Utility.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_","")); } else { - val = Util.stringToDouble(str); + val = TT_Utility.stringToDouble(str); } if (!Objects.equals(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value1s, value1tb.getText())) { ((GT_Container_ParamText) mContainer).value1s = value1tb.getText(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 6ad3282d9d..3f8e9170de 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.util.Vec3Impl; @@ -295,7 +295,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - Util.intBitsToString(TecTech.RANDOM.nextInt()), + TT_Utility.intBitsToString(TecTech.RANDOM.nextInt()), EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.computer.desc")//You need it to process the number above }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index dc218da530..306d470a8e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -36,7 +36,7 @@ import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.isInputEqual; +import static com.github.technus.tectech.util.TT_Utility.isInputEqual; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index 8583f03193..474dbdab2c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -43,7 +43,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.Util.areBitsSet; +import static com.github.technus.tectech.util.TT_Utility.areBitsSet; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index c2d1012910..1691940997 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -134,8 +134,8 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0) + (ePowerPassButton?8:0)); for(int i=128,k=208,j=0;j<20;j++,i+=4,k+=4) { - Util.sendDouble(eParamsOut[j], this, var1, i); - Util.sendDouble(eParamsIn[j], this, var1, k); + TT_Utility.sendDouble(eParamsOut[j], this, var1, i); + TT_Utility.sendDouble(eParamsIn[j], this, var1, k); } } } @@ -159,10 +159,10 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPassCover = (par2 & 8) == 8; } else if(par1>=128 && par1<208){ int pos=(par1-128)>>2; - eParamsOut[pos]=Double.longBitsToDouble(eParamsOutl[pos]=Util.receiveLong(eParamsOutl[pos],par1&0xFFFFFFFC,par1,par2)); + eParamsOut[pos]=Double.longBitsToDouble(eParamsOutl[pos]= TT_Utility.receiveLong(eParamsOutl[pos],par1&0xFFFFFFFC,par1,par2)); }else if(par1>=208 && par1<288){ int pos=(par1-208)>>2; - eParamsIn[pos]=Double.longBitsToDouble(eParamsInl[pos]=Util.receiveLong(eParamsInl[pos],par1&0xFFFFFFFC,par1,par2)); + eParamsIn[pos]=Double.longBitsToDouble(eParamsInl[pos]= TT_Utility.receiveLong(eParamsInl[pos],par1&0xFFFFFFFC,par1,par2)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 3a019de78c..d4fe7b6e49 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefini import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; @@ -47,7 +47,7 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.util.DoubleCount.div; -import static com.github.technus.tectech.util.Util.getTier; +import static com.github.technus.tectech.util.TT_Utility.getTier; import static java.lang.Math.min; /** @@ -295,7 +295,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW + ":" + EnumChatFormatting.AQUA + "I " + parametrization.getStatusIn(hatchNo, paramID).name.get()); list.add(EnumChatFormatting.WHITE + "Value: " + - EnumChatFormatting.AQUA + Util.doubleToString(parametrization.getIn(hatchNo, paramID))); + EnumChatFormatting.AQUA + TT_Utility.doubleToString(parametrization.getIn(hatchNo, paramID))); try { list.add(parametrization.groups[hatchNo].parameterIn[paramID].getBrief()); } catch (NullPointerException | IndexOutOfBoundsException e) { @@ -318,7 +318,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW + ":" + EnumChatFormatting.AQUA + "O " + parametrization.getStatusOut(hatchNo, paramID).name.get()); list.add(EnumChatFormatting.WHITE + "Value: " + - EnumChatFormatting.AQUA + Util.doubleToString(parametrization.getOut(hatchNo, paramID))); + EnumChatFormatting.AQUA + TT_Utility.doubleToString(parametrization.getOut(hatchNo, paramID))); try { list.add(parametrization.groups[hatchNo].parameterOut[paramID].getBrief()); } catch (NullPointerException | IndexOutOfBoundsException e) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index 2c4217aaba..1f791963e0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -6,7 +6,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -110,7 +110,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return false; } loadedMachine = newMachine; - Supplier behaviourSupplier = GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine)); + Supplier behaviourSupplier = GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new TT_Utility.ItemStack_NoNBT(newMachine)); if (currentBehaviour == null && behaviourSupplier == null) { return false; } @@ -132,11 +132,11 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return true; } - private static final HashMap> BEHAVIOUR_MAP = new HashMap<>(); + private static final HashMap> BEHAVIOUR_MAP = new HashMap<>(); public static void registerBehaviour(Supplier behaviour, ItemStack is) { - BEHAVIOUR_MAP.put(new Util.ItemStack_NoNBT(is), behaviour); - TecTech.LOGGER.info("Registered EM machine behaviour " + behaviour.get().getClass().getSimpleName() + ' ' + new Util.ItemStack_NoNBT(is).toString()); + BEHAVIOUR_MAP.put(new TT_Utility.ItemStack_NoNBT(is), behaviour); + TecTech.LOGGER.info("Registered EM machine behaviour " + behaviour.get().getClass().getSimpleName() + ' ' + new TT_Utility.ItemStack_NoNBT(is).toString()); } public interface IBehaviour { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java index 737046729f..8d9c245d98 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_BuckConverter; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_BuckConverter; import cpw.mods.fml.relauncher.Side; @@ -29,12 +29,12 @@ public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMac public GT_MetaTileEntity_BuckConverter(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_BuckConverter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java index 748b680faa..fe300f7ed2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DataReader; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DataReader; import cpw.mods.fml.common.FMLCommonHandler; @@ -38,17 +38,17 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by Tec on 23.03.2017. */ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine { - private static final HashMap> RENDER_REGISTRY =new HashMap<>(); - public static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; + private static final HashMap> RENDER_REGISTRY =new HashMap<>(); + public static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { super(aID,aName,aNameRegional,aTier,1,"",1,1,"dataReader.png",""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_DataReader(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName,aTier,1,aDescription,aTextures,1,1,"dataReader.png",""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override @@ -91,7 +91,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return DID_NOT_FIND_RECIPE; } ItemStack input=getInputAt(0); - for(IDataRender render:getRenders(new Util.ItemStack_NoNBT(input))){ + for(IDataRender render:getRenders(new TT_Utility.ItemStack_NoNBT(input))){ if(render.canRender(input,mTier)){ mOutputItems[0]=input.copy(); input.stackSize-=1; @@ -175,7 +175,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return maxEUInput()*4L; } - public static void addDataRender(Util.ItemStack_NoNBT stack, IDataRender render){ + public static void addDataRender(TT_Utility.ItemStack_NoNBT stack, IDataRender render){ ArrayList renders = RENDER_REGISTRY.computeIfAbsent(stack, k -> new ArrayList<>()); if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { render.loadResources(); @@ -183,7 +183,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine renders.add(render); } - public static List getRenders(Util.ItemStack_NoNBT stack){ + public static List getRenders(TT_Utility.ItemStack_NoNBT stack){ ArrayList iDataRenders = RENDER_REGISTRY.get(stack); return iDataRenders==null?Collections.emptyList():iDataRenders; } @@ -205,7 +205,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine } public static void run(){ - addDataRender(new Util.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)),new IDataRender() { + addDataRender(new TT_Utility.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)),new IDataRender() { @SideOnly(Side.CLIENT) private ResourceLocation bg; @SideOnly(Side.CLIENT) @@ -271,8 +271,8 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine public void renderForeground(ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui, FontRenderer font) { int time=itemStack.stackTagCompound.getInteger("time"); int EUt=itemStack.stackTagCompound.getInteger("eu"); - font.drawString("Assembly Line Recipe", 7, 8, 0x80a0ff); - font.drawString(GT_Utility.trans("152","Total: ") + GT_Utility.formatNumbers((long)time * EUt) + " EU",7,93, 0x80a0ff); + font.drawString(translateToLocal("tt.keyphrase.Ass_line_recipe"), 7, 8, 0x80a0ff); + font.drawString(GT_Utility.trans("152","Total: ") + GT_Utility.formatNumbers((long) time * EUt) + " EU",7,93, 0x80a0ff); font.drawString(GT_Utility.trans("153","Usage: ") + GT_Utility.formatNumbers(EUt) + " EU/t",7,103, 0x80a0ff); font.drawString(GT_Utility.trans("154","Voltage: ") + GT_Utility.formatNumbers(EUt) + " EU",7,113, 0x80a0ff); font.drawString(GT_Utility.trans("155","Amperage: ") + 1 ,7,123, 0x80a0ff); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java index 0d5a59a5c1..82f8c77536 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugPollutor; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugPollutor; @@ -35,12 +35,12 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac public GT_MetaTileEntity_DebugPollutor(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_DebugPollutor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java index 931da27e6c..327f66ecf6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugPowerGenerator; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugPowerGenerator; import cpw.mods.fml.relauncher.Side; @@ -32,12 +32,12 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie public GT_MetaTileEntity_DebugPowerGenerator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_DebugPowerGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java index 01d5e2321e..46b3d5e927 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java @@ -4,7 +4,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugStructureWriter; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugStructureWriter; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import com.gtnewhorizon.structurelib.structure.StructureUtility; import cpw.mods.fml.relauncher.Side; @@ -20,13 +20,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Comparator; -import java.util.function.Function; - import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -41,12 +37,12 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti public GT_MetaTileEntity_DebugStructureWriter(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_DebugStructureWriter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java index 9bac9df2f3..0ab08c356e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java @@ -10,7 +10,7 @@ import com.github.technus.avrClone.memory.EepromMemory; import com.github.technus.avrClone.memory.RemovableMemory; import com.github.technus.avrClone.memory.program.ProgramMemory; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.mechanics.avr.SidedRedstone; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -41,12 +41,12 @@ public class GT_MetaTileEntity_MicroController extends GT_MetaTileEntity_TieredM public GT_MetaTileEntity_MicroController(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, "AVR Micro-controller"); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_MicroController(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); core=new AvrCore(); core.setUsingImmersiveOperands(false); core.setInstructionRegistry(InstructionRegistry.INSTRUCTION_REGISTRY_OP); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java index 03ec9efd89..3ba7bcf885 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -36,12 +36,12 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac public GT_MetaTileEntity_OwnerDetector(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } public GT_MetaTileEntity_OwnerDetector(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - Util.setTier(aTier,this); + TT_Utility.setTier(aTier,this); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java index 61f2259c5c..c5391537a6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,12 +13,12 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TT_Transformer extends GT_MetaTileEntity_Transformer { public GT_MetaTileEntity_TT_Transformer(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, ""); - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } public GT_MetaTileEntity_TT_Transformer(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } @Override 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 3b240e4c56..475e8ac10a 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 @@ -7,8 +7,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.spark.RendererMessage; import com.github.technus.tectech.mechanics.spark.ThaumSpark; -import com.github.technus.tectech.util.Util; -import com.google.common.collect.ArrayListMultimap; +import com.github.technus.tectech.util.TT_Utility; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; import com.gtnewhorizon.structurelib.util.Vec3Impl; @@ -62,7 +61,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) { super(aID, aName, aNameRegional, aTier, "", aSlotCount); - Util.setTier(aTier, this); + TT_Utility.setTier(aTier, this); } public GT_MetaTileEntity_TeslaCoil(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java index b40a9126b7..4e4a235ca4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPollutor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -129,8 +129,8 @@ public class GT_Container_DebugPollutor for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - Util.sendInteger(pollution,this,var1,100); - Util.sendFloat(anomaly,this,var1,102); + TT_Utility.sendInteger(pollution,this,var1,100); + TT_Utility.sendFloat(anomaly,this,var1,102); } } @@ -141,11 +141,11 @@ public class GT_Container_DebugPollutor switch (par1) { case 100: case 101: - pollution = Util.receiveInteger(pollution,100,par1,par2); + pollution = TT_Utility.receiveInteger(pollution,100,par1,par2); break; case 102: case 103: - anomaly = Float.intBitsToFloat(anomalyInt=Util.receiveInteger(anomalyInt,102,par1,par2)); + anomaly = Float.intBitsToFloat(anomalyInt= TT_Utility.receiveInteger(anomalyInt,102,par1,par2)); break; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java index 6b6b778d40..1cff7e6c30 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -19,7 +19,7 @@ public class GT_GUIContainer_BuckConverter extends GT_GUIContainerMetaTile_Machi if (mContainer != null) { GT_Container_BuckConverter buck = (GT_Container_BuckConverter) mContainer; fontRendererObj.drawString("EUT: " + buck.EUT, 46, 24, 16448255); - fontRendererObj.drawString("TIER: " + VN[Util.getTier(buck.EUT<0?-buck.EUT:buck.EUT)], 46, 32, 16448255); + fontRendererObj.drawString("TIER: " + VN[TT_Utility.getTier(buck.EUT<0?-buck.EUT:buck.EUT)], 46, 32, 16448255); fontRendererObj.drawString("AMP: " + buck.AMP, 46, 40, 16448255); fontRendererObj.drawString("SUM: " + (long)buck.AMP*buck.EUT, 46, 48, 16448255); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java index bde5b90048..4731374c31 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; @@ -15,7 +15,6 @@ import net.minecraft.util.IIcon; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import java.util.ArrayList; import java.util.List; public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine { @@ -116,7 +115,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) { if (thing != null) { for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing))) { + GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(thing))) { if (render.canRender(thing, mTier)) { if (!GT_Utility.areStacksEqual(stack, thing, false)) { render.initRender(thing); @@ -134,7 +133,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine return false; } for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { + GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); return true; @@ -148,7 +147,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine return false; } for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { + GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderTooltips(stack, mouseX, mouseY, this); return true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java index ee6e952040..f1f5050d9d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.TT_Utility; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -19,7 +19,7 @@ public class GT_GUIContainer_DebugPowerGenerator extends GT_GUIContainerMetaTile if (mContainer != null) { GT_Container_DebugPowerGenerator dpg = (GT_Container_DebugPowerGenerator) mContainer; fontRendererObj.drawString("EUT: " + dpg.EUT, 46, 24, 16448255); - fontRendererObj.drawString("TIER: " + VN[Util.getTier(dpg.EUT<0?-dpg.EUT:dpg.EUT)], 46, 32, 16448255); + fontRendererObj.drawString("TIER: " + VN[TT_Utility.getTier(dpg.EUT<0?-dpg.EUT:dpg.EUT)], 46, 32, 16448255); fontRendererObj.drawString("AMP: " + dpg.AMP, 46, 40, 16448255); fontRendererObj.drawString("SUM: " + (long)dpg.AMP*dpg.EUT, 46, 48, 16448255); } diff --git a/src/main/java/com/github/technus/tectech/util/TT_Utility.java b/src/main/java/com/github/technus/tectech/util/TT_Utility.java new file mode 100644 index 0000000000..c989fe1e1f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/TT_Utility.java @@ -0,0 +1,613 @@ +package com.github.technus.tectech.util; + +import com.github.technus.tectech.TecTech; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.storage.IPlayerFileData; +import net.minecraft.world.storage.SaveHandler; +import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * Created by Tec on 21.03.2017. + */ +public final class TT_Utility { + private TT_Utility() { + } + private static final Map formaters=new HashMap<>(); + + private static Formatter getFormatter(){ + return formaters.computeIfAbsent(Locale.getDefault(Locale.Category.FORMAT), Formatter::new); + } + + public static String formatNumberShortExp(double value){ + return getFormatter().format("%.3E", value).toString(); + } + + public static String formatNumberExp(double value){ + return getFormatter().format("%+.5E", value).toString(); + } + + public static String formatNumberIntHex(int value){ + return getFormatter().format("%08X", value).toString(); + } + + @SuppressWarnings("ComparatorMethodParameterNotUsed") + public static > SortedSet> entriesSortedByValues(Map map) { + SortedSet> sortedEntries = new TreeSet<>( + (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 int bitStringToInt(String bits){ + if(bits==null){ + return 0; + } + if(bits.length() > 32){ + throw new NumberFormatException("Too long!"); + } + return Integer.parseInt(bits,2); + } + + public static int hexStringToInt(String hex){ + if(hex==null){ + return 0; + } + if(hex.length()>8){ + throw new NumberFormatException("Too long!"); + } + return Integer.parseInt(hex,16); + } + + public static double stringToDouble(String str){ + if(str==null){ + return 0; + } + return Double.parseDouble(str); + } + + public static double getValue(String in1) { + String str = in1.toLowerCase(); + double val; + try { + if (str.contains("b")) { + String[] split = str.split("b"); + val = TT_Utility.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); + } else if (str.contains("x")) { + String[] split = str.split("x"); + val = TT_Utility.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); + } else { + val = TT_Utility.stringToDouble(str); + } + return val; + } catch (Exception e) { + return 0; + } + } + + + public static String intBitsToString(int number) { + StringBuilder result = new StringBuilder(16); + + for (int i = 31; i >= 0; i--) { + int mask = 1 << i; + result.append((number & mask) != 0 ? "1" : "0"); + + if (i % 8 == 0) { + result.append(' '); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + + public static String intBitsToShortString(int number) { + StringBuilder result = new StringBuilder(35); + + for (int i = 31; i >= 0; i--) { + int mask = 1 << i; + result.append((number & mask) != 0 ? ":" : "."); + + if (i % 8 == 0) { + result.append('|'); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + + public static String longBitsToShortString(long number) { + StringBuilder result = new StringBuilder(71); + + for (int i = 63; i >= 0; i--) { + long mask = 1L << i; + result.append((number & mask) != 0 ? ":" : "."); + + if (i % 8 == 0) { + result.append('|'); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + + public static float map(float x, float in_min, float in_max, float out_min, float out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { + if (!GregTech_API.sPostloadFinished) { + return false; + } + if (requiredFluidInputs.length > 0 && givenFluidInputs == null) { + return false; + } + int amt; + for (FluidStack tFluid : requiredFluidInputs) { + if (tFluid != null) { + boolean temp = true; + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) { + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aFluid.amount; + if (amt < 1) { + temp = false; + break; + } + } + } + if (temp) { + return false; + } + } + } + + if (requiredInputs.length > 0 && givenInputs == null) { + return false; + } + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + boolean temp = true; + for (ItemStack aStack : givenInputs) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aStack.stackSize; + if (amt < 1) { + temp = false; + break; + } + } + } + if (temp) { + return false; + } + } + } + + if (aDecreaseStacksizeBySuccess) { + if (givenFluidInputs != null) { + for (FluidStack tFluid : requiredFluidInputs) { + if (tFluid != null) { + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) { + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + aFluid.amount -= amt; + break; + } + if (aFluid.amount < amt) { + amt -= aFluid.amount; + aFluid.amount = 0; + } else { + aFluid.amount -= amt; + break; + } + } + } + } + } + } + + if (givenInputs != null) { + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + for (ItemStack aStack : givenInputs) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { + if (aDontCheckStackSizes) { + aStack.stackSize -= amt; + break; + } + if (aStack.stackSize < amt) { + amt -= aStack.stackSize; + aStack.stackSize = 0; + } else { + aStack.stackSize -= amt; + break; + } + } + } + } + } + } + } + + return true; + } + + public static String getUniqueIdentifier(ItemStack is) { + return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); + } + + public static byte getTier(long l) { + byte b = -1; + + do { + ++b; + if (b >= CommonValues.V.length) { + return b; + } + } while (l > CommonValues.V[b]); + + return b; + } + + public static String[] splitButDifferent(String string, String delimiter) { + String[] strings = new String[StringUtils.countMatches(string, delimiter) + 1]; + int lastEnd = 0; + for (int i = 0; i < strings.length - 1; i++) { + int nextEnd = string.indexOf(delimiter, lastEnd); + strings[i] = string.substring(lastEnd, nextEnd); + lastEnd = nextEnd + delimiter.length(); + } + strings[strings.length - 1] = string.substring(lastEnd); + return strings; + } + + public static String[] infoFromNBT(NBTTagCompound nbt) { + String[] strings = new String[nbt.getInteger("i")]; + for (int i = 0; i < strings.length; i++) { + strings[i] = nbt.getString(Integer.toString(i)); + } + return strings; + } + + public static boolean areBitsSet(int setBits, int testedValue) { + return (testedValue & setBits) == setBits; + } + + public static class ItemStack_NoNBT implements Comparable { + public final Item mItem; + public final int mStackSize; + public final int mMetaData; + + public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) { + this.mItem = aItem; + this.mStackSize = (byte) ((int) aStackSize); + this.mMetaData = (short) ((int) aMetaData); + } + + public ItemStack_NoNBT(ItemStack aStack) { + if (aStack == null) { + mItem = null; + mStackSize = mMetaData = 0; + } else { + mItem = aStack.getItem(); + mStackSize = aStack.stackSize; + mMetaData = Items.feather.getDamage(aStack); + } + } + + @Override + public int compareTo(ItemStack_NoNBT o) { + if (mMetaData > o.mMetaData) return 1; + if (mMetaData < o.mMetaData) return -1; + if (mStackSize > o.mStackSize) return 1; + if (mStackSize < o.mStackSize) return -1; + if (mItem != null && o.mItem != null) + return mItem.getUnlocalizedName().compareTo(o.mItem.getUnlocalizedName()); + if (mItem == null && o.mItem == null) return 0; + if (mItem != null) return 1; + return -1; + } + + @Override + public boolean equals(Object aStack) { + return aStack == this || + (aStack instanceof ItemStack_NoNBT && + ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && + ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize && + ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData); + } + + @Override + public int hashCode() { + return (mItem != null ? mItem.getUnlocalizedName().hashCode() : 0) ^ (mMetaData << 16) ^ (mStackSize << 24); + } + + @Override + public String toString() { + return Integer.toString(hashCode()) + ' ' + (mItem == null ? "null" : mItem.getUnlocalizedName()) + ' ' + mMetaData + ' ' + mStackSize; + } + } + + public static void setTier(int tier,Object me){ + try{ + Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); + field.setAccessible(true); + field.set(me,(byte)tier); + }catch (Exception e){ + //e.printStackTrace(); + } + } + + public static StringBuilder receiveString(StringBuilder previousValue, int startIndex, int index, int value){ + int sizeReq=index-startIndex; + if(value==0){ + previousValue.setLength(Math.min(previousValue.length(),sizeReq)); + }else { + previousValue.setLength(Math.max(previousValue.length(),sizeReq)); + previousValue.setCharAt(sizeReq,(char)value); + } + return previousValue; + } + + @Deprecated + public static double receiveDouble(double previousValue, int startIndex, int index, int value){ + return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue),startIndex,index,value)); + } + + public static long receiveLong(long previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_FFFF_FFFF_0000L; + previousValue|=value; + break; + case 1: + previousValue&=0xFFFF_FFFF_0000_FFFFL; + previousValue|=(long)value<<16; + break; + case 2: + previousValue&=0xFFFF_0000_FFFF_FFFFL; + previousValue|=(long)value<<32; + break; + case 3: + previousValue&=0x0000_FFFF_FFFF_FFFFL; + previousValue|=(long)value<<48; + break; + } + return previousValue; + } + + public static void sendString(StringBuilder string,Container container, ICrafting crafter,int startIndex){ + for (int i = 0; i < string.length(); i++) { + crafter.sendProgressBarUpdate(container,startIndex++,string.charAt(i)); + } + crafter.sendProgressBarUpdate(container,startIndex,0); + } + + public static void sendDouble(double value,Container container, ICrafting crafter,int startIndex){ + sendLong(Double.doubleToLongBits(value),container,crafter,startIndex); + } + + public static void sendLong(long value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF0000L)>>>16)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF00000000L)>>>32)); + crafter.sendProgressBarUpdate(container, startIndex, (int)((value & 0xFFFF000000000000L)>>>48)); + } + + @Deprecated + public static float receiveFloat(float previousValue, int startIndex, int index, int value){ + return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue),startIndex,index,value)); + } + + public static int receiveInteger(int previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_0000; + previousValue|=value; + break; + case 1: + previousValue&=0x0000_FFFF; + previousValue|=value<<16; + break; + } + return previousValue; + } + + public static void sendFloat(float value,Container container, ICrafting crafter,int startIndex){ + sendInteger(Float.floatToIntBits(value),container,crafter,startIndex); + } + + public static void sendInteger(int value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000)>>>16); + } + + public static String doubleToString(double value){ + if(value==(long)value){ + return Long.toString((long)value); + } + return Double.toString(value); + } + + public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk){ + int x=chunk.getCenterXPos(); + int z=chunk.getCenterZPosition(); + return world.checkChunksExist(x, 0, z, x, 0, z); + } + + public static NBTTagCompound getPlayerData(UUID uuid1,UUID uuid2,String extension) { + try { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (uuid1 != null && uuid2!=null) { + IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); + SaveHandler sh = (SaveHandler)playerNBTManagerObj; + File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); + String id1=uuid1.toString(); + NBTTagCompound tagCompound=read(new File(dir, id1 + "."+extension)); + if(tagCompound!=null){ + return tagCompound; + } + tagCompound=readBackup(new File(dir, id1 + "."+extension+"_bak")); + if(tagCompound!=null){ + return tagCompound; + } + String id2=uuid2.toString(); + tagCompound=read(new File(dir, id2 + "."+extension)); + if(tagCompound!=null){ + return tagCompound; + } + tagCompound=readBackup(new File(dir, id2 + "."+extension+"_bak")); + if(tagCompound!=null){ + return tagCompound; + } + } + } + } catch (Exception ignored) {} + return new NBTTagCompound(); + } + + public static void savePlayerFile(EntityPlayer player,String extension, NBTTagCompound data) { + try { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (player != null) { + IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); + SaveHandler sh = (SaveHandler)playerNBTManagerObj; + File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); + String id1=player.getUniqueID().toString(); + write(new File(dir, id1 + "."+extension),data); + write(new File(dir, id1 + "."+extension+"_bak"),data); + String id2=UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(StandardCharsets.UTF_8)).toString(); + write(new File(dir, id2 + "."+extension),data); + write(new File(dir, id2 + "."+extension+"_bak"),data); + } + } + } catch (Exception ignored) {} + } + + private static NBTTagCompound read(File file){ + if (file != null && file.exists()) { + try(FileInputStream fileInputStream= new FileInputStream(file)) { + return CompressedStreamTools.readCompressed(fileInputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); + } + } + return null; + } + + private static NBTTagCompound readBackup(File file){ + if (file != null && file.exists()) { + try(FileInputStream fileInputStream= new FileInputStream(file)) { + return CompressedStreamTools.readCompressed(fileInputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); + return new NBTTagCompound(); + } + } + return null; + } + + private static void write(File file,NBTTagCompound tagCompound){ + if (file != null) { + if(tagCompound==null){ + if(file.exists()) file.delete(); + }else { + try(FileOutputStream fileOutputStream= new FileOutputStream(file)) { + CompressedStreamTools.writeCompressed(tagCompound,fileOutputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot write NBT File: "+file.getAbsolutePath()); + } + } + } + } + + public static AxisAlignedBB fromChunkCoordIntPair(ChunkCoordIntPair chunkCoordIntPair){ + int x=chunkCoordIntPair.chunkXPos<<4; + int z=chunkCoordIntPair.chunkZPos<<4; + return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); + } + + public static AxisAlignedBB fromChunk(Chunk chunk){ + int x=chunk.xPosition<<4; + int z=chunk.zPosition<<4; + return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); + } + + public static String getConcated(String[] strings,String separator){ + StringBuilder stringBuilder = new StringBuilder(); + for (String string : strings) { + stringBuilder.append(string).append(separator); + } + int length = stringBuilder.length(); + if(length >=separator.length()){ + stringBuilder.setLength(length -separator.length()); + } + return stringBuilder.toString(); + } + + public static double getMagnitude3D(double[] in) + { + return Math.sqrt(in[0]*in[0]+in[1]*in[1]+in[2]*in[2]); + } + + public static void normalize3D(double[] in, double[] out) + { + double mag=getMagnitude3D(in); + out[0]=in[0]/mag; + out[1]=in[1]/mag; + out[2]=in[2]/mag; + } + + public static void crossProduct3D(double[] inA, double[] inB, double[] out) + { + out[0] = inA[1] * inB[2] - inA[2] * inB[1]; + out[1] = inA[2] * inB[0] - inA[0] * inB[2]; + out[2] = inA[0] * inB[1] - inA[1] * inB[0]; + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java deleted file mode 100644 index 489246e061..0000000000 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ /dev/null @@ -1,596 +0,0 @@ -package com.github.technus.tectech.util; - -import com.github.technus.tectech.TecTech; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.storage.IPlayerFileData; -import net.minecraft.world.storage.SaveHandler; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.StringUtils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.lang.reflect.Field; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * Created by Tec on 21.03.2017. - */ -public final class Util { - private Util() { - } - - @SuppressWarnings("ComparatorMethodParameterNotUsed") - public static > SortedSet> entriesSortedByValues(Map map) { - SortedSet> sortedEntries = new TreeSet<>( - (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 int bitStringToInt(String bits){ - if(bits==null){ - return 0; - } - if(bits.length() > 32){ - throw new NumberFormatException("Too long!"); - } - return Integer.parseInt(bits,2); - } - - public static int hexStringToInt(String hex){ - if(hex==null){ - return 0; - } - if(hex.length()>8){ - throw new NumberFormatException("Too long!"); - } - return Integer.parseInt(hex,16); - } - - public static double stringToDouble(String str){ - if(str==null){ - return 0; - } - return Double.parseDouble(str); - } - - public static double getValue(String in1) { - String str = in1.toLowerCase(); - double val; - try { - if (str.contains("b")) { - String[] split = str.split("b"); - val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); - } else if (str.contains("x")) { - String[] split = str.split("x"); - val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); - } else { - val = Util.stringToDouble(str); - } - return val; - } catch (Exception e) { - return 0; - } - } - - - public static String intBitsToString(int number) { - StringBuilder result = new StringBuilder(16); - - for (int i = 31; i >= 0; i--) { - int mask = 1 << i; - result.append((number & mask) != 0 ? "1" : "0"); - - if (i % 8 == 0) { - result.append(' '); - } - } - result.replace(result.length() - 1, result.length(), ""); - - return result.toString(); - } - - public static String intBitsToShortString(int number) { - StringBuilder result = new StringBuilder(35); - - for (int i = 31; i >= 0; i--) { - int mask = 1 << i; - result.append((number & mask) != 0 ? ":" : "."); - - if (i % 8 == 0) { - result.append('|'); - } - } - result.replace(result.length() - 1, result.length(), ""); - - return result.toString(); - } - - public static String longBitsToShortString(long number) { - StringBuilder result = new StringBuilder(71); - - for (int i = 63; i >= 0; i--) { - long mask = 1L << i; - result.append((number & mask) != 0 ? ":" : "."); - - if (i % 8 == 0) { - result.append('|'); - } - } - result.replace(result.length() - 1, result.length(), ""); - - return result.toString(); - } - - public static float map(float x, float in_min, float in_max, float out_min, float out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; - } - - public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { - if (!GregTech_API.sPostloadFinished) { - return false; - } - if (requiredFluidInputs.length > 0 && givenFluidInputs == null) { - return false; - } - int amt; - for (FluidStack tFluid : requiredFluidInputs) { - if (tFluid != null) { - boolean temp = true; - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aFluid.amount; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - - if (requiredInputs.length > 0 && givenInputs == null) { - return false; - } - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - boolean temp = true; - for (ItemStack aStack : givenInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - - if (aDecreaseStacksizeBySuccess) { - if (givenFluidInputs != null) { - for (FluidStack tFluid : requiredFluidInputs) { - if (tFluid != null) { - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - aFluid.amount -= amt; - break; - } - if (aFluid.amount < amt) { - amt -= aFluid.amount; - aFluid.amount = 0; - } else { - aFluid.amount -= amt; - break; - } - } - } - } - } - } - - if (givenInputs != null) { - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - for (ItemStack aStack : givenInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - aStack.stackSize -= amt; - break; - } - if (aStack.stackSize < amt) { - amt -= aStack.stackSize; - aStack.stackSize = 0; - } else { - aStack.stackSize -= amt; - break; - } - } - } - } - } - } - } - - return true; - } - - public static String getUniqueIdentifier(ItemStack is) { - return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); - } - - public static byte getTier(long l) { - byte b = -1; - - do { - ++b; - if (b >= CommonValues.V.length) { - return b; - } - } while (l > CommonValues.V[b]); - - return b; - } - - public static String[] splitButDifferent(String string, String delimiter) { - String[] strings = new String[StringUtils.countMatches(string, delimiter) + 1]; - int lastEnd = 0; - for (int i = 0; i < strings.length - 1; i++) { - int nextEnd = string.indexOf(delimiter, lastEnd); - strings[i] = string.substring(lastEnd, nextEnd); - lastEnd = nextEnd + delimiter.length(); - } - strings[strings.length - 1] = string.substring(lastEnd); - return strings; - } - - public static String[] infoFromNBT(NBTTagCompound nbt) { - String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) { - strings[i] = nbt.getString(Integer.toString(i)); - } - return strings; - } - - public static boolean areBitsSet(int setBits, int testedValue) { - return (testedValue & setBits) == setBits; - } - - public static class ItemStack_NoNBT implements Comparable { - public final Item mItem; - public final int mStackSize; - public final int mMetaData; - - public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) { - this.mItem = aItem; - this.mStackSize = (byte) ((int) aStackSize); - this.mMetaData = (short) ((int) aMetaData); - } - - public ItemStack_NoNBT(ItemStack aStack) { - if (aStack == null) { - mItem = null; - mStackSize = mMetaData = 0; - } else { - mItem = aStack.getItem(); - mStackSize = aStack.stackSize; - mMetaData = Items.feather.getDamage(aStack); - } - } - - @Override - public int compareTo(ItemStack_NoNBT o) { - if (mMetaData > o.mMetaData) return 1; - if (mMetaData < o.mMetaData) return -1; - if (mStackSize > o.mStackSize) return 1; - if (mStackSize < o.mStackSize) return -1; - if (mItem != null && o.mItem != null) - return mItem.getUnlocalizedName().compareTo(o.mItem.getUnlocalizedName()); - if (mItem == null && o.mItem == null) return 0; - if (mItem != null) return 1; - return -1; - } - - @Override - public boolean equals(Object aStack) { - return aStack == this || - (aStack instanceof ItemStack_NoNBT && - ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && - ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize && - ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData); - } - - @Override - public int hashCode() { - return (mItem != null ? mItem.getUnlocalizedName().hashCode() : 0) ^ (mMetaData << 16) ^ (mStackSize << 24); - } - - @Override - public String toString() { - return Integer.toString(hashCode()) + ' ' + (mItem == null ? "null" : mItem.getUnlocalizedName()) + ' ' + mMetaData + ' ' + mStackSize; - } - } - - public static void setTier(int tier,Object me){ - try{ - Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); - field.setAccessible(true); - field.set(me,(byte)tier); - }catch (Exception e){ - //e.printStackTrace(); - } - } - - public static StringBuilder receiveString(StringBuilder previousValue, int startIndex, int index, int value){ - int sizeReq=index-startIndex; - if(value==0){ - previousValue.setLength(Math.min(previousValue.length(),sizeReq)); - }else { - previousValue.setLength(Math.max(previousValue.length(),sizeReq)); - previousValue.setCharAt(sizeReq,(char)value); - } - return previousValue; - } - - @Deprecated - public static double receiveDouble(double previousValue, int startIndex, int index, int value){ - return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue),startIndex,index,value)); - } - - public static long receiveLong(long previousValue, int startIndex, int index, int value){ - value &=0xFFFF; - switch (index-startIndex){ - case 0: - previousValue&= 0xFFFF_FFFF_FFFF_0000L; - previousValue|=value; - break; - case 1: - previousValue&=0xFFFF_FFFF_0000_FFFFL; - previousValue|=value<<16; - break; - case 2: - previousValue&=0xFFFF_0000_FFFF_FFFFL; - previousValue|=(long)value<<32; - break; - case 3: - previousValue&=0x0000_FFFF_FFFF_FFFFL; - previousValue|=(long)value<<48; - break; - } - return previousValue; - } - - public static void sendString(StringBuilder string,Container container, ICrafting crafter,int startIndex){ - for (int i = 0; i < string.length(); i++) { - crafter.sendProgressBarUpdate(container,startIndex++,string.charAt(i)); - } - crafter.sendProgressBarUpdate(container,startIndex,0); - } - - public static void sendDouble(double value,Container container, ICrafting crafter,int startIndex){ - sendLong(Double.doubleToLongBits(value),container,crafter,startIndex); - } - - public static void sendLong(long value,Container container, ICrafting crafter,int startIndex){ - crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); - crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF0000L)>>>16)); - crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF00000000L)>>>32)); - crafter.sendProgressBarUpdate(container, startIndex, (int)((value & 0xFFFF000000000000L)>>>48)); - } - - @Deprecated - public static float receiveFloat(float previousValue, int startIndex, int index, int value){ - return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue),startIndex,index,value)); - } - - public static int receiveInteger(int previousValue, int startIndex, int index, int value){ - value &=0xFFFF; - switch (index-startIndex){ - case 0: - previousValue&= 0xFFFF_0000; - previousValue|=value; - break; - case 1: - previousValue&=0x0000_FFFF; - previousValue|=value<<16; - break; - } - return previousValue; - } - - public static void sendFloat(float value,Container container, ICrafting crafter,int startIndex){ - sendInteger(Float.floatToIntBits(value),container,crafter,startIndex); - } - - public static void sendInteger(int value,Container container, ICrafting crafter,int startIndex){ - crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); - crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000)>>>16); - } - - public static String doubleToString(double value){ - if(value==(long)value){ - return Long.toString((long)value); - } - return Double.toString(value); - } - - public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk){ - int x=chunk.getCenterXPos(); - int z=chunk.getCenterZPosition(); - return world.checkChunksExist(x, 0, z, x, 0, z); - } - - public static NBTTagCompound getPlayerData(UUID uuid1,UUID uuid2,String extension) { - try { - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - if (uuid1 != null && uuid2!=null) { - IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); - SaveHandler sh = (SaveHandler)playerNBTManagerObj; - File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); - String id1=uuid1.toString(); - NBTTagCompound tagCompound=read(new File(dir, id1 + "."+extension)); - if(tagCompound!=null){ - return tagCompound; - } - tagCompound=readBackup(new File(dir, id1 + "."+extension+"_bak")); - if(tagCompound!=null){ - return tagCompound; - } - String id2=uuid2.toString(); - tagCompound=read(new File(dir, id2 + "."+extension)); - if(tagCompound!=null){ - return tagCompound; - } - tagCompound=readBackup(new File(dir, id2 + "."+extension+"_bak")); - if(tagCompound!=null){ - return tagCompound; - } - } - } - } catch (Exception ignored) {} - return new NBTTagCompound(); - } - - public static void savePlayerFile(EntityPlayer player,String extension, NBTTagCompound data) { - try { - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - if (player != null) { - IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); - SaveHandler sh = (SaveHandler)playerNBTManagerObj; - File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); - String id1=player.getUniqueID().toString(); - write(new File(dir, id1 + "."+extension),data); - write(new File(dir, id1 + "."+extension+"_bak"),data); - String id2=UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(StandardCharsets.UTF_8)).toString(); - write(new File(dir, id2 + "."+extension),data); - write(new File(dir, id2 + "."+extension+"_bak"),data); - } - } - } catch (Exception ignored) {} - } - - private static NBTTagCompound read(File file){ - if (file != null && file.exists()) { - try(FileInputStream fileInputStream= new FileInputStream(file)) { - return CompressedStreamTools.readCompressed(fileInputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); - } - } - return null; - } - - private static NBTTagCompound readBackup(File file){ - if (file != null && file.exists()) { - try(FileInputStream fileInputStream= new FileInputStream(file)) { - return CompressedStreamTools.readCompressed(fileInputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); - return new NBTTagCompound(); - } - } - return null; - } - - private static void write(File file,NBTTagCompound tagCompound){ - if (file != null) { - if(tagCompound==null){ - if(file.exists()) file.delete(); - }else { - try(FileOutputStream fileOutputStream= new FileOutputStream(file)) { - CompressedStreamTools.writeCompressed(tagCompound,fileOutputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot write NBT File: "+file.getAbsolutePath()); - } - } - } - } - - public static AxisAlignedBB fromChunkCoordIntPair(ChunkCoordIntPair chunkCoordIntPair){ - int x=chunkCoordIntPair.chunkXPos<<4; - int z=chunkCoordIntPair.chunkZPos<<4; - return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); - } - - public static AxisAlignedBB fromChunk(Chunk chunk){ - int x=chunk.xPosition<<4; - int z=chunk.zPosition<<4; - return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); - } - - public static String getConcated(String[] strings,String separator){ - StringBuilder stringBuilder = new StringBuilder(); - for (String string : strings) { - stringBuilder.append(string).append(separator); - } - int length = stringBuilder.length(); - if(length >=separator.length()){ - stringBuilder.setLength(length -separator.length()); - } - return stringBuilder.toString(); - } - - public static double getMagnitude3D(double in[]) - { - return Math.sqrt(in[0]*in[0]+in[1]*in[1]+in[2]*in[2]); - } - - public static void normalize3D(double in[], double out[]) - { - double mag=getMagnitude3D(in); - out[0]=in[0]/mag; - out[1]=in[1]/mag; - out[2]=in[2]/mag; - } - - public static void crossProduct3D(double inA[], double inB[], double out[]) - { - out[0] = inA[1] * inB[2] - inA[2] * inB[1]; - out[1] = inA[2] * inB[0] - inA[0] * inB[2]; - out[2] = inA[0] * inB[1] - inA[1] * inB[0]; - } -} diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 79c46b07a2..f9ab756696 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -865,6 +865,7 @@ tt.keyphrase.Average_IO_(max)=Voltage I/O (max) tt.keyphrase.Average_IO_max=Voltage I/O max tt.keyphrase.Amperage_IO_(max)=Amperage I/O (max) tt.keyphrase.Side_capabilities=Side capabilities +tt.keyphrase.Ass_line_recipe=Assembly Line Recipe #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret @@ -873,6 +874,8 @@ tile.turretBaseEM.name=Elemental Turret Base tt.keyword.mol=mol tt.keyword.itemMols=items tt.keyword.mbMols=mb +#that the thing wont decay +tt.keyword.stable=STABLE #EM types tt.keyword.Primitive=Primitive tt.keyword.Element=Element -- cgit From fe3e8abfbb46a4fd75906e3d41e0dfb4435b8403 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 6 Feb 2022 20:47:22 +0100 Subject: More locale work --- .../blocks/turretheads/TurretHeadItemEM.java | 2 +- .../definitions/EMComplexAspectDefinition.java | 39 +------ .../tectech/mechanics/anomaly/CancerCommand.java | 2 + .../core/definitions/EMComplexTemplate.java | 4 +- .../core/definitions/EMPrimitiveTemplate.java | 40 +------ .../core/definitions/IEMDefinition.java | 68 ++++++++--- .../core/maps/EMConstantStackMap.java | 15 +-- .../core/maps/EMDefinitionStackMap.java | 15 +-- .../core/maps/EMInstanceStackMap.java | 124 ++++++++------------ .../elementalMatter/core/maps/EMStackMap.java | 7 +- .../elementalMatter/core/maps/IEMMapRead.java | 61 ++++------ .../elementalMatter/core/maps/IEMMapWrite.java | 14 +-- .../core/maps/IEMMapWriteExact.java | 22 ++-- .../core/stacks/EMInstanceStack.java | 56 ++++----- .../definitions/complex/EMAtomDefinition.java | 40 +------ .../definitions/complex/EMHadronDefinition.java | 35 +----- .../github/technus/tectech/proxy/ClientProxy.java | 1 + .../item/DebugElementalInstanceContainer_EM.java | 69 ++++------- .../item/ElementalDefinitionContainer_EM.java | 52 ++------- .../item/ElementalDefinitionScanStorage_EM.java | 71 ++++-------- .../tectech/thing/item/gui/ScanDisplayScreen.java | 126 +++++++++++---------- .../thing/item/renderElemental/IElementalItem.java | 16 ++- .../item/renderElemental/RenderElementalName.java | 8 +- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 10 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 60 ++++++---- .../github/technus/tectech/util/CommonValues.java | 49 ++++---- .../github/technus/tectech/util/TT_Utility.java | 41 ++++++- src/main/resources/assets/tectech/lang/en_US.lang | 54 +++++++-- 28 files changed, 457 insertions(+), 644 deletions(-) (limited to 'src/main/resources/assets/tectech/lang/en_US.lang') 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 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 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 @@ -182,37 +177,6 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate { return Short.MIN_VALUE; } - @Override - public void addScanShortSymbols(ArrayList 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 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()) { 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,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, 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,Cloneable {//IM String getShortLocalizedName(); - default String getLocalizedName(){ - return getLocalizedTypeName()+": "+getShortLocalizedName(); + default String getLocalizedName() { + return getLocalizedTypeName() + ": " + getShortLocalizedName(); } String getShortSymbol(); String getSymbol(); - void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel); + default void addScanShortSymbols(ArrayList 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 lines, int capabilities, long energyLevel); + default void addScanResults(ArrayList 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,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,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 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 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 implements IEMMapWrite { //Constructors - public EMInstanceStackMap() {} + public EMInstanceStackMap() { + } public EMInstanceStackMap(EMInstanceStack... inSafe) { this(true, inSafe); @@ -35,8 +36,8 @@ public final class EMInstanceStackMap extends EMStackMap implem public EMInstanceStackMap(boolean clone, EMInstanceStack... in) { if (clone) { - EMInstanceStack[] stacks =new EMInstanceStack[in.length]; - for(int i=0;i implem } private EMInstanceStackMap(boolean clone, NavigableMap 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 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 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 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 getScanShortSymbols(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e: getBackingMap().entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - public ArrayList getScanInfo(int[] capabilities) { - ArrayList list=new ArrayList<>(16); - for(Map.Entry e: getBackingMap().entrySet()){ - e.getValue().addScanResults(list,capabilities); + ArrayList list = new ArrayList<>(16); + for (Map.Entry 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 implem } //NBT - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { - EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = EMInstanceStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].getDefinition().equals(nbtE__)) { - throw new EMException("Something went Wrong"); - } - } - return new EMInstanceStackMap(false, instances); + return new EMInstanceStackMap(false, unpackNBT(EMInstanceStack.class, inner -> EMInstanceStack.fromNBT(registry, inner), nbt)); } @Override public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(EMInstanceStack stack: getBackingMap().values()){ - build.append(stack.toString()).append('\n'); + StringBuilder build = new StringBuilder("Instance Stack Map\n"); + for (Map.Entry stack : entrySet()) { + build.append(stack.getValue().toString()).append('\n'); } return build.toString(); } - public EMInstanceStack[] takeAllToArray(){ + public EMInstanceStack[] takeAllToArray() { EMInstanceStack[] newStack = valuesToArray();//just in case to uncouple The map - this.getBackingMap().clear(); + clear(); return newStack; } - public EMInstanceStackMap takeAll(){ - EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map - this.getBackingMap().clear(); + public EMInstanceStackMap takeAll() { + EMInstanceStackMap newStack = new EMInstanceStackMap(false, new TreeMap<>(getBackingMap()));//just in case to uncouple The map + clear(); return newStack; } @@ -201,36 +169,36 @@ public final class EMInstanceStackMap extends EMStackMap implem @Override public EMInstanceStack putUnify(EMInstanceStack stack) { - EMInstanceStack target =get(stack.getDefinition()); - if(target==null) { + EMInstanceStack target = get(stack.getDefinition()); + if (target == null) { putReplace(stack); return stack; } double newAmount = add(target.getAmount(), stack.getAmount()); if (IEMStack.isValidAmount(newAmount)) { - stack=target.unifyIntoThis(stack); + stack = target.unifyIntoThis(stack); putReplace(stack); return stack; - }else { - removeKey(stack); + } else { + removeKey(stack.getDefinition()); return null; } } @Override public EMInstanceStack putUnifyExact(EMInstanceStack stack) { - EMInstanceStack target =get(stack.getDefinition()); - if(target==null) { + EMInstanceStack target = get(stack.getDefinition()); + if (target == null) { putReplace(stack); return stack; } - double newAmount = target.getAmount()+stack.getAmount(); + double newAmount = target.getAmount() + stack.getAmount(); if (IEMStack.isValidAmount(newAmount)) { - stack=target.unifyIntoThis(stack); + stack = target.unifyIntoThis(stack); putReplace(stack); return stack; - }else { - removeKey(stack); + } else { + removeKey(stack.getDefinition()); return null; } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java index 3765fe6098..10241cb457 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; @@ -41,9 +42,9 @@ abstract class EMStackMap implements IEMMapRead { @Override public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(getBackingMap().size() << 4); - for (T stack : getBackingMap().values()) { - hash += stack.getDefinition().hashCode(); + int hash = -(size() << 4); + for (Map.Entry entry : entrySet()) { + hash += entry.getValue().getDefinition().hashCode(); } return hash; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java index 86ca6de8a8..6bd12a849b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -1,17 +1,20 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.maps; import com.github.technus.tectech.TecTech; +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.IEMStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.util.TT_Utility; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import java.lang.reflect.Array; import java.util.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; import static com.github.technus.tectech.util.DoubleCount.ulpSigned; +import static com.github.technus.tectech.util.TT_Utility.packNBT; import static net.minecraft.util.StatCollector.translateToLocal; public interface IEMMapRead extends Comparable>, Cloneable { @@ -87,53 +90,27 @@ public interface IEMMapRead extends Comparable instance : entrySet()) { + info[i++] = instance.getValue().getDefinition().getShortSymbol(); } return info; } default String[] getElementalInfo() { - String[] info = new String[size() * 3]; - int i = 0; - for (T defStack : values()) { - info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT+" "+translateToLocal("tt.keyword.mol"); - i += 3; + String[] info = new String[size()]; + int i = 0; + for (Map.Entry entry : entrySet()) { + T 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.charge") + ": " + EnumChatFormatting.GREEN + TT_Utility.formatNumberExp(instance.getCharge()) + " " + translateToLocal("tt.keyword.unit.charge") + EnumChatFormatting.RESET; } return info; } //NBT - default NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - default NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - default NBTTagCompound toNBT(EMDefinitionsRegistry registry) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", size()); - int i = 0; - for (Map.Entry entry : entrySet()) { - nbt.setTag(Integer.toString(i++), entry.getValue().toNBT(registry)); - } - return nbt; + return packNBT(t -> t.toNBT(registry),valuesToArray()); } @Override @@ -143,11 +120,11 @@ public interface IEMMapRead extends Comparable iterator = values().iterator(); - Iterator iteratorO = o.values().iterator(); + Iterator> iterator = entrySet().iterator(); + Iterator> iteratorO = o.entrySet().iterator(); while (iterator.hasNext()) { - int result = iterator.next().compareTo(iteratorO.next()); + int result = iterator.next().getValue().compareTo(iteratorO.next().getValue()); if (result != 0) { return result; } @@ -232,7 +209,7 @@ public interface IEMMapRead extends Comparable= amount; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java index 15815f2ee0..ac94f9cf6b 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -27,15 +27,15 @@ public interface IEMMapWrite extends IEMMapWriteExact { } default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired){ - T current=getBackingMap().get(def); + T current=get(def); if(current!=null){ if(current.getAmount()>=amountRequired){ double newAmount=sub(current.getAmount(),amountToConsume); if(IEMStack.isValidAmount(newAmount)){ current=(T)current.mutateAmount(newAmount); - getBackingMap().put(current.getDefinition(),current); + putReplace(current); }else { - getBackingMap().remove(current.getDefinition()); + removeKey(current.getDefinition()); } return true; } @@ -82,7 +82,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { * @return new mapping or null if merging actually removed stuff */ default T putUnify(T stack) { - T target=getBackingMap().get(stack.getDefinition()); + T target=get(stack.getDefinition()); if(target==null) { putReplace(stack); return stack; @@ -93,7 +93,7 @@ public interface IEMMapWrite extends IEMMapWriteExact { putReplace(stack); return stack; }else { - removeKey(stack); + removeKey(stack.getDefinition()); return null; } } @@ -105,8 +105,8 @@ public interface IEMMapWrite extends IEMMapWriteExact { } default void putUnifyAll(IEMMapRead inTreeUnsafe) { - for (T in : inTreeUnsafe.values()) { - putUnify(in); + for (Map.Entry in : inTreeUnsafe.entrySet()) { + putUnify(in.getValue()); } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java index 9da971944c..b30497a47d 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -21,10 +21,6 @@ public interface IEMMapWriteExact extends IEMMapRead { return getBackingMap().remove(def); } - default T removeKey(IEMStack has) { - return removeKey(has.getDefinition()); - } - default boolean removeKeys(IEMDefinition... definitions) { boolean hadAll=true; for (IEMDefinition def : definitions) { @@ -36,7 +32,7 @@ public interface IEMMapWriteExact extends IEMMapRead { default boolean removeKeys(IEMStack... hasElementalDefinition) { boolean hadAll=true; for (IEMStack has : hasElementalDefinition) { - hadAll&=removeKey(has)!=null; + hadAll&=removeKey(has.getDefinition())!=null; } return hadAll; } @@ -55,7 +51,7 @@ public interface IEMMapWriteExact extends IEMMapRead { boolean hadAll=containsAllKeys(hasElementalDefinition); if(hadAll){ for (IEMStack stack : hasElementalDefinition) { - removeKey(stack); + removeKey(stack.getDefinition()); } } return hadAll; @@ -91,15 +87,15 @@ public interface IEMMapWriteExact extends IEMMapRead { * @return */ default boolean removeAmountExact(IEMDefinition def, double amountToConsume){ - T current=getBackingMap().get(def); + T current=get(def); if(current!=null){ double newAmount=current.getAmount()-amountToConsume; if(newAmount>=0){ if(current.isValidAmount()){ current=(T)current.mutateAmount(newAmount); - getBackingMap().put(current.getDefinition(),current); + putReplace(current); } else { - getBackingMap().remove(current.getDefinition()); + removeKey(current.getDefinition()); } return true; } @@ -136,7 +132,7 @@ public interface IEMMapWriteExact extends IEMMapRead { } default T putUnifyExact(T stack) { - T target=getBackingMap().get(stack.getDefinition()); + T target=get(stack.getDefinition()); if(target==null) { putReplace(stack); return stack; @@ -147,7 +143,7 @@ public interface IEMMapWriteExact extends IEMMapRead { putReplace(stack); return stack; }else { - removeKey(stack); + removeKey(stack.getDefinition()); return null; } } @@ -159,8 +155,8 @@ public interface IEMMapWriteExact extends IEMMapRead { } default void putUnifyAllExact(IEMMapRead inTreeUnsafe) { - for (T in : inTreeUnsafe.values()) { - putUnifyExact(in); + for (Map.Entry in : inTreeUnsafe.entrySet()) { + putUnifyExact(in.getValue()); } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java index d37a8bd099..0dbd56609e 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java @@ -38,7 +38,7 @@ public final class EMInstanceStack implements IEMStack { //energy - if positive then particle should try to decay private long energy; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private int color; + private int color; private double lifeTime; private double lifeTimeMult; @@ -487,46 +487,32 @@ public final class EMInstanceStack implements IEMStack { return this; } - public void addScanShortSymbols(ArrayList lines, int[] detailsOnDepthLevels) { - int capabilities = detailsOnDepthLevels[0]; - getDefinition().addScanShortSymbols(lines, capabilities, energy); - //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - //private void scanShortSymbolsContents(ArrayList lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ - // if(definitions!=null && depth lines, int[] detailsOnDepthLevels) { int capabilities = detailsOnDepthLevels[0]; if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { - lines.add("DEPTH = " + 0); + lines.add(translateToLocal("tt.keyword.scan.depth") + " = " + 0); } - getDefinition().addScanResults(lines, capabilities, energy); + getDefinition().addScanResults(lines, capabilities, energy, TecTech.definitionsRegistry); + if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { - lines.add("TIME MULT = " + lifeTimeMult); - if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("TIME SPAN = " + lifeTime + " s"); - } + lines.add(translateToLocal("tt.keyword.scan.life_mult") + " = " + lifeTimeMult); } if (TT_Utility.areBitsSet(SCAN_GET_AGE, capabilities)) { - lines.add("AGE = " + getAge() + " s"); + lines.add(translateToLocal("tt.keyword.scan.age") + " = " + getAge() + " " + translateToLocal("tt.keyword.unit.time")); } - if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add("COLOR = " + color + " RGB or CMY"); + if (TT_Utility.areBitsSet(SCAN_GET_COLOR_VALUE, capabilities)) { + lines.add(translateToLocal("tt.keyword.scan.color") + " = " + color); + } + if (TT_Utility.areBitsSet(SCAN_GET_ENERGY, capabilities)) { + lines.add(translateToLocal("tt.keyword.scan.energy") + " = " + getDefinition().getEnergyDiffBetweenStates(0, energy) + " " + translateToLocal("tt.keyword.unit.energy")); } if (TT_Utility.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { - lines.add("ENERGY = " + energy); + lines.add(translateToLocal("tt.keyword.scan.energyLevel") + " = " + energy); } if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")); + lines.add(translateToLocal("tt.keyword.scan.amount") + " = " + getAmount() / AVOGADRO_CONSTANT + " " + translateToLocal("tt.keyword.unit.mol")); } + scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); } @@ -536,11 +522,11 @@ public final class EMInstanceStack implements IEMStack { for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { lines.add("");//def separator if (TT_Utility.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) { - lines.add("DEPTH = " + depth); + lines.add(translateToLocal("tt.keyword.scan.depth") +" = " + depth); } - getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy); + getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy, TecTech.definitionsRegistry); if (TT_Utility.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) { - lines.add("AMOUNT = " + definitionStack.getAmount()); + lines.add(translateToLocal("tt.keyword.scan.count")+" = " + definitionStack.getAmount()); } scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); } @@ -551,10 +537,10 @@ public final class EMInstanceStack implements IEMStack { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", getDefinition().toNBT(registry)); nbt.setDouble("Q", getAmount()); - nbt.setDouble("M", lifeTimeMult); + nbt.setDouble("M", getLifeTimeMultiplier()); nbt.setDouble("A", getAge()); - nbt.setLong("e", energy); - nbt.setInteger("c", color); + nbt.setLong("e", getEnergy()); + nbt.setInteger("c", getColor()); return nbt; } @@ -588,7 +574,7 @@ public final class EMInstanceStack implements IEMStack { @Override public String toString() { - return getDefinition().toString() + ' ' + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")+" " + getMass()+" eV/c^2"; + return getDefinition().toString() + ' ' + getAmount() / AVOGADRO_CONSTANT + " " + translateToLocal("tt.keyword.unit.mol") + " " + getMass() + " "+translateToLocal("tt.keyword.unit.mass"); } public void setAmount(double amount) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java index 20e58216c1..e14a034b81 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -14,7 +14,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition; -import com.github.technus.tectech.util.TT_Utility; import com.github.technus.tectech.util.XSTR; import java.util.*; @@ -23,7 +22,6 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; 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 com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.OrePrefixes.dust; @@ -1366,7 +1364,7 @@ public class EMAtomDefinition extends EMComplexTemplate { } @Override - protected String getIndirectTagValue() { + protected String getTagValue() { return nbtType; } @@ -1673,40 +1671,4 @@ public class EMAtomDefinition extends EMComplexTemplate { public int hashCode() { return hash; } - - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); - } - if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = " + getLocalizedName()); - lines.add("SYMBOL = " + getSymbol()); - } - if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); - } - if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if (iaeaDefinitionExistsAndHasEnergyLevels && TT_Utility.areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { - for (int i = 1; i < getIaea().getEnergeticStatesArray().length; i++) { - lines.add("E LEVEL " + i + " = " + getIaea().getEnergeticStatesArray()[i].energy + " eV"); - } - } - if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("HALF LIFE = " + getRawTimeSpan(energyLevel) + " s"); - lines.add(" At current energy level"); - } - } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java index 85cb07ea33..9fb551e45c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java @@ -15,7 +15,6 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; -import com.github.technus.tectech.util.TT_Utility; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.oredict.OreDictionary; @@ -28,7 +27,6 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; 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; /** @@ -371,7 +369,7 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i } @Override - protected String getIndirectTagValue() { + protected String getTagValue() { return nbtType; } @@ -459,37 +457,6 @@ public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i return hash; } - @Override - public void addScanShortSymbols(ArrayList lines, int capabilities, long energyLevel) { - if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList lines, int capabilities, long energyLevel) { - if (TT_Utility.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); - } - if (TT_Utility.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = " + getLocalizedTypeName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if (TT_Utility.areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add("CHARGE = " + getCharge() / 3D + " e"); - } - if (TT_Utility.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); - } - if (TT_Utility.areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if (TT_Utility.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("HALF LIFE = " + getRawTimeSpan(energyLevel) + " s"); - lines.add(" " + "At current energy level"); - } - } - public double getRawLifeTime() { return rawLifeTime; } diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index d7baec4ef5..043bd87a21 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -38,6 +38,7 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(ElementalDefinitionContainer_EM.INSTANCE, RenderElementalName.INSTANCE); MinecraftForgeClient.registerItemRenderer(DebugElementalInstanceContainer_EM.INSTANCE, RenderElementalName.INSTANCE); + //MinecraftForgeClient.registerItemRenderer(ElementalDefinitionScanStorage_EM.INSTANCE, RenderElementalName.INSTANCE); if(Loader.isModLoaded("openmodularturrets")) { new TT_turret_loader().run(); diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index 7d7880adca..c19ec6dda1 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -51,8 +51,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE @Override public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - NBTTagCompound tNBT = aStack.getTagCompound(); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + NBTTagCompound tNBT = aStack.getTagCompound(); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (aPlayer instanceof EntityPlayerMP) { aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { @@ -61,7 +61,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content"))); } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -71,12 +71,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ((IEMContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); - tNBT.removeTag("info"); } else if (content.hasStacks()) { ((IEMContainer) metaTE).purgeOverflow(); - tNBT.setTag("info", content.getInfoNBT()); tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols", content.getShortSymbolsNBT()); + tNBT.setTag("symbols", TT_Utility.packStrings(content.getShortSymbolsInfo())); content.clear(); } return true; @@ -86,30 +84,14 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE return aPlayer instanceof EntityPlayerMP; } - public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content){ + public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content) { NBTTagCompound tNBT = aStack.getTagCompound(); - if(tNBT==null){ - tNBT=new NBTTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); aStack.setTagCompound(tNBT); } - if (tNBT.hasKey("content")) { - try { - content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return aStack; - } - tNBT.removeTag("content"); - tNBT.removeTag("info"); - tNBT.removeTag("symbols"); - } else if (content.hasStacks()) { - tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols", content.getShortSymbolsNBT()); - content.clear(); - } + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); + tNBT.setTag("symbols", TT_Utility.packStrings(content.getShortSymbolsInfo())); return aStack; } @@ -118,14 +100,18 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aList.add(CommonValues.TEC_MARK_EM); try { NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("info")) { + if (tNBT != null && tNBT.hasKey("content")) { aList.add(translateToLocal("item.em.debugContainer.desc.0") + ": ");//Contains - Collections.addAll(aList, TT_Utility.infoFromNBT(tNBT.getCompoundTag("info"))); + EMInstanceStackMap content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); + Collections.addAll(aList, content.getElementalInfo()); } else { aList.add(translateToLocal("item.em.debugContainer.desc.1"));//Container for elemental matter - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.debugContainer.desc.2"));//Right click on elemental hatches } + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.debugContainer.desc.2"));//Right click on elemental hatches } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } aList.add(translateToLocal("item.em.debugContainer.desc.3"));//---Unexpected Termination--- } } @@ -140,31 +126,16 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")), + for (IEMDefinition definition : TecTech.definitionsRegistry.getStacksRegisteredForDisplay()) { + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName() + " " + 1 + " " + translateToLocal("tt.keyword.unit.mbMols")), new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")), + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName() + " " + 1 + " " + translateToLocal("tt.keyword.unit.itemMols")), new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")), + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName() + " " + 1000 + " " + translateToLocal("tt.keyword.unit.mbMols")), new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } - @Override - public String getSymbol(ItemStack aStack, int index) { - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); - return strings[index%strings.length]; - } else { - return null; - } - } catch (Exception e) { - return "#!"; - } - } - @Override @SideOnly(CLIENT) public FontRenderer getFontRenderer(ItemStack stack) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index dede2e36ce..85a853e8aa 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.TT_Utility; @@ -38,30 +39,14 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem setCreativeTab(creativeTabEM); } - //return previous thing - public static EMConstantStackMap setContent(ItemStack containerItem, EMConstantStackMap definitions){ - if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { - NBTTagCompound tNBT = containerItem.stackTagCompound; - if (tNBT == null) { - tNBT = containerItem.stackTagCompound = new NBTTagCompound(); - } - - EMConstantStackMap oldMap =null; - if (tNBT.hasKey("content")) { - try { - oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); - } catch (EMException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - tNBT.setTag("info", definitions.getInfoNBT()); - tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); - tNBT.setTag("symbols",definitions.getShortSymbolsNBT()); - return oldMap; + public static void setContent(ItemStack aStack, EMConstantStackMap definitions){ + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + aStack.setTagCompound(tNBT); } - return null; + tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); + tNBT.setTag("symbols", TT_Utility.packStrings(definitions.getShortSymbolsInfo())); } public static EMConstantStackMap getContent(ItemStack containerItem){ @@ -99,7 +84,6 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem } } } - tNBT.removeTag("info"); tNBT.removeTag("content"); tNBT.removeTag("symbols"); return oldMap; @@ -112,9 +96,10 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem aList.add(CommonValues.TEC_MARK_EM); try { NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("info")) { + if (tNBT != null && tNBT.hasKey("content")) { aList.add(translateToLocal("item.em.definitionContainer.desc.0") + ": ");//Should Contain - Collections.addAll(aList, TT_Utility.infoFromNBT(tNBT.getCompoundTag("info"))); + EMDefinitionStackMap content = EMDefinitionStackMap.fromNBT(TecTech.definitionsRegistry, tNBT.getCompoundTag("content")); + Collections.addAll(aList, content.getElementalInfo()); } else { aList.add(translateToLocal("item.em.definitionContainer.desc.1"));//Recipe Hint } @@ -135,21 +120,6 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem list.add(that); } - @Override - public String getSymbol(ItemStack aStack, int index) { - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); - return strings[index%strings.length]; - } else { - return null; - } - } catch (Exception e) { - return "#!"; - } - } - @Override @SideOnly(CLIENT) public FontRenderer getFontRenderer(ItemStack stack) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index 22fc6e65a9..976b034455 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -5,9 +5,7 @@ import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.util.TT_Utility; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,6 +20,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import java.util.ArrayList; import java.util.List; import static com.github.technus.tectech.Reference.MODID; @@ -32,7 +31,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. */ -public final class ElementalDefinitionScanStorage_EM extends Item implements IElementalItem { +public final class ElementalDefinitionScanStorage_EM extends Item { public static ElementalDefinitionScanStorage_EM INSTANCE; public static IIcon offline, online; @@ -44,14 +43,14 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl } //return previous thing - public static void setContent(ItemStack containerItem, EMInstanceStackMap definitions, int[] detailsOnDepthLevels){ - if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { - if (containerItem.stackTagCompound == null) { - containerItem.stackTagCompound = new NBTTagCompound(); - } - containerItem.stackTagCompound.setTag("elementalInfo", definitions.getScanInfoNBT(detailsOnDepthLevels)); - containerItem.stackTagCompound.setTag("symbols",definitions.getScanShortSymbolsNBT(detailsOnDepthLevels)); + public static void setContent(ItemStack aStack, EMInstanceStackMap instances, int[] detailsOnDepthLevels){ + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + aStack.setTagCompound(tNBT); } + tNBT.setTag("content", instances.toNBT(TecTech.definitionsRegistry)); + tNBT.setIntArray("scanConfiguration", detailsOnDepthLevels); } public static void clearContent(ItemStack containerItem){ @@ -63,9 +62,10 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl } } - public static String[] getLines(ItemStack containerItem){ - if(containerItem.stackTagCompound!=null && containerItem.stackTagCompound.hasKey("elementalInfo")) { - return TT_Utility.infoFromNBT(containerItem.stackTagCompound.getCompoundTag("elementalInfo")); + public static ArrayList getLines(ItemStack containerItem){ + if(containerItem.stackTagCompound!=null && containerItem.stackTagCompound.hasKey("content")) { + EMInstanceStackMap contenet = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, containerItem.stackTagCompound.getCompoundTag("contenet")); + return contenet.getScanInfo(containerItem.stackTagCompound.getIntArray("scanConfiguration")); } return null; } @@ -73,19 +73,11 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_EM); - try { - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { - aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.definitionScanStorage.desc.0"));//Contains scan result - aList.add(translateToLocal("item.em.definitionScanStorage.desc.1"));//Use to read - //if(DEBUG_MODE) { - // aList.add("DEBUG MODE INFO - U CHEATER"); - // Collections.addAll(aList, Util.infoFromNBT(aStack.stackTagCompound.getCompoundTag("elementalInfo"))); - //} - } else { - aList.add(translateToLocal("item.em.definitionScanStorage.desc.2"));//Storage for matter scan data - } - } catch (Exception e) { - aList.add(translateToLocal("item.em.definitionScanStorage.desc.3"));//---Unexpected Termination--- + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("content")) { + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.definitionScanStorage.desc.0"));//Contains scan result + aList.add(translateToLocal("item.em.definitionScanStorage.desc.1"));//Use to read + } else { + aList.add(translateToLocal("item.em.definitionScanStorage.desc.2"));//Storage for matter scan data } } @@ -105,19 +97,13 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl @Override public IIcon getIconIndex(ItemStack itemStack) { NBTTagCompound tagCompound=itemStack.stackTagCompound; - if(tagCompound!=null && tagCompound.hasKey("elementalInfo")) { - return online; - } - return offline; + return tagCompound != null && tagCompound.hasKey("content") ? online : offline; } @Override public IIcon getIcon(ItemStack itemStack, int pass) { NBTTagCompound tagCompound=itemStack.stackTagCompound; - if(tagCompound!=null && tagCompound.hasKey("elementalInfo")) { - return online; - } - return offline; + return tagCompound != null && tagCompound.hasKey("content") ? online : offline; } @Override @@ -130,28 +116,13 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if(world.isRemote){ NBTTagCompound tagCompound=itemStack.stackTagCompound; - if(tagCompound!=null && tagCompound.hasKey("elementalInfo")) { + if(tagCompound!=null && tagCompound.hasKey("content")) { player.openGui(TecTech.instance, ModGuiHandler.SCAN_DISPLAY_SCREEN_ID, world, 0, 0, 0); } } return itemStack; } - @Override - public String getSymbol(ItemStack aStack, int index) { - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT != null && tNBT.hasKey("symbols")) { - String[] strings= TT_Utility.infoFromNBT(tNBT.getCompoundTag("symbols")); - return strings[index%strings.length]; - } else { - return null; - } - } catch (Exception e) { - return "#!"; - } - } - @Override @SideOnly(CLIENT) public FontRenderer getFontRenderer(ItemStack stack) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java index 20f59b56e2..b4300c763c 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java +++ b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java @@ -11,6 +11,8 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import java.util.Objects; + import static com.github.technus.tectech.Reference.MODID; import static org.lwjgl.opengl.GL11.*; @@ -18,24 +20,26 @@ import static org.lwjgl.opengl.GL11.*; * Created by danie_000 on 17.12.2017. */ public class ScanDisplayScreen extends GuiScreen { - private static final int sizeX=240,sizeY=220, renderedLines =10; - private int baseX,baseY; - private Button up,down,pgUp,pgDown; + private static final int sizeX = 240, sizeY = 220, renderedLines = 10; + private int baseX, baseY; + private Button up, down, pgUp, pgDown; private final String[] lines; - private int firstLine; + private int firstLine; - private static final ResourceLocation[] BACKGROUNDS =new ResourceLocation[]{new ResourceLocation(MODID+":textures/gui/scanDisplayScreen1.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen2.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen3.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen4.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen5.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen6.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen7.png"), - new ResourceLocation(MODID+":textures/gui/scanDisplayScreen8.png")}; - private static final ResourceLocation ITEM =new ResourceLocation(MODID+":textures/gui/scanDisplayItem.png"); + private static final ResourceLocation[] BACKGROUNDS = new ResourceLocation[]{ + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen1.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen2.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen3.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen4.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen5.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen6.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen7.png"), + new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen8.png")}; + private static final ResourceLocation ITEM = + new ResourceLocation(MODID + ":textures/gui/scanDisplayItem.png"); - public ScanDisplayScreen(EntityPlayer player){ - lines=ElementalDefinitionScanStorage_EM.getLines(player.getHeldItem()); + public ScanDisplayScreen(EntityPlayer player) { + lines = Objects.requireNonNull(ElementalDefinitionScanStorage_EM.getLines(player.getHeldItem())).toArray(new String[0]); } @Override @@ -43,48 +47,48 @@ public class ScanDisplayScreen extends GuiScreen { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); mc.getTextureManager().bindTexture(ITEM); - long tick=System.currentTimeMillis()/150; - int itick=(int)(tick%12); - drawTexturedModalRect(baseX+99,baseY+189,32*(itick/6),32*(itick%6), 32, 32); - mc.getTextureManager().bindTexture(BACKGROUNDS[(int)(tick%8)]); - drawTexturedModalRect(baseX,baseY,0,0, sizeX, sizeY); + long tick = System.currentTimeMillis() / 150; + int itick = (int) (tick % 12); + drawTexturedModalRect(baseX + 99, baseY + 189, 32 * (itick / 6), 32 * (itick % 6), 32, 32); + mc.getTextureManager().bindTexture(BACKGROUNDS[(int) (tick % 8)]); + drawTexturedModalRect(baseX, baseY, 0, 0, sizeX, sizeY); glDisable(GL_BLEND); - super.drawScreen(x,y,partialTicks); + super.drawScreen(x, y, partialTicks); - itick=(TecTech.RANDOM.nextInt(0x66)<<16)+0x77EEFF; - int textBaseX=baseX+20; - int textBaseXX=baseX+95; - int textBaseY=baseY+28; - for(int i=firstLine-1, j=8;i>=0 && j!=0;i--,j/=2){ - int equalPos=lines[i].indexOf('='); - if(equalPos>=0){ - TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0,equalPos), textBaseX, textBaseY - 8 + j, 200, itick); + itick = (TecTech.RANDOM.nextInt(0x66) << 16) + 0x77EEFF; + int textBaseX = baseX + 20; + int textBaseXX = baseX + 95; + int textBaseY = baseY + 28; + for (int i = firstLine - 1, j = 8; i >= 0 && j != 0; i--, j /= 2) { + int equalPos = lines[i].indexOf('='); + if (equalPos >= 0) { + TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY - 8 + j, 200, itick); TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY - 8 + j, 200, itick); - }else { + } else { TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY - 8 + j, 200, itick); } } - for(int i = firstLine, j = 0; i=0){ - TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0,equalPos), textBaseX, textBaseY, 200, itick); + int equalPos = lines[i].indexOf('='); + if (equalPos >= 0) { + TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY, 200, itick); TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY, 200, itick); - }else { + } else { TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY, 200, itick); } } - for(int i = firstLine+ renderedLines, j = 8; i=0){ - TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0,equalPos), textBaseX, textBaseY + 17 - j, 200, itick); + for (int i = firstLine + renderedLines, j = 8; i < lines.length && j != 0; i++, j /= 2) { + int equalPos = lines[i].indexOf('='); + if (equalPos >= 0) { + TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY + 17 - j, 200, itick); TecTechFontRender.INSTANCE.drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY + 17 - j, 200, itick); - }else { + } else { TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY + 17 - j, 200, itick); } } - TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(firstLine), textBaseX, baseY+146, 200, itick); - TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(lines.length), textBaseX, baseY+157, 200, itick); + TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(firstLine), textBaseX, baseY + 146, 200, itick); + TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(lines.length), textBaseX, baseY + 157, 200, itick); } @Override @@ -94,13 +98,13 @@ public class ScanDisplayScreen extends GuiScreen { @Override public void initGui() { - baseX=(width- sizeX)/2; - baseY=(height- sizeY)/2-12; - int buttonBaseY=baseY+145; - buttonList.add(pgUp= new Button(0, baseX + 77, buttonBaseY, 0, 220)); - buttonList.add(up= new Button(1, baseX + 99, buttonBaseY, 20, 220)); - buttonList.add(down= new Button(2, baseX + 121, buttonBaseY, 40, 220)); - buttonList.add(pgDown= new Button(3, baseX + 143, buttonBaseY, 60, 220)); + baseX = (width - sizeX) / 2; + baseY = (height - sizeY) / 2 - 12; + int buttonBaseY = baseY + 145; + buttonList.add(pgUp = new Button(0, baseX + 77, buttonBaseY, 0, 220)); + buttonList.add(up = new Button(1, baseX + 99, buttonBaseY, 20, 220)); + buttonList.add(down = new Button(2, baseX + 121, buttonBaseY, 40, 220)); + buttonList.add(pgDown = new Button(3, baseX + 143, buttonBaseY, 60, 220)); } @Override @@ -125,19 +129,18 @@ public class ScanDisplayScreen extends GuiScreen { } } - private static class Button extends GuiButton{ - int u,v; - Button(int id,int x,int y,int u,int v){ - super(id,x,y,20,20,""); - this.u=u; - this.v=v; + private static class Button extends GuiButton { + int u, v; + + Button(int id, int x, int y, int u, int v) { + super(id, x, y, 20, 20, ""); + this.u = u; + this.v = v; } @Override - public void drawButton(Minecraft mc, int xPos, int yPos) - { - if (visible) - { + public void drawButton(Minecraft mc, int xPos, int yPos) { + if (visible) { field_146123_n = xPos >= xPosition && yPos >= yPosition && xPos < xPosition + width && yPos < yPosition + height; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -150,9 +153,8 @@ public class ScanDisplayScreen extends GuiScreen { //play cool sound fx @Override - public void func_146113_a(SoundHandler soundHandler) - { - soundHandler.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(MODID+":fx_click"), 1.0F)); + public void func_146113_a(SoundHandler soundHandler) { + soundHandler.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(MODID + ":fx_click"), 1.0F)); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java index ab68691eaa..37dce47e5f 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java @@ -1,7 +1,21 @@ package com.github.technus.tectech.thing.item.renderElemental; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.util.TT_Utility.getSomeString; public interface IElementalItem { - String getSymbol(ItemStack stack,int index); + default String getSymbol(ItemStack stack,int index){ + try { + NBTTagCompound tNBT = stack.getTagCompound(); + if (tNBT != null && tNBT.hasKey("symbols")) { + return getSomeString(tNBT.getCompoundTag("symbols"),index); + } else { + return null; + } + } catch (Exception e) { + return "#!"; + } + } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java index bfb1a188d8..e897f615ad 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java +++ b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java @@ -32,10 +32,10 @@ public class RenderElementalName implements IItemRenderer { for (int i = 0; i < item.getRenderPasses(itemStack.getItemDamage()); i++) { IIcon icon = item.getIcon(itemStack, i); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0, 0.0, 0.0, (double)icon.getMinU(), (double)icon.getMinV()); - tessellator.addVertexWithUV(0.0, 16, 0.0, (double)icon.getMinU(), (double)icon.getMaxV()); - tessellator.addVertexWithUV(16, 16, 0.0, (double)icon.getMaxU(), (double)icon.getMaxV()); - tessellator.addVertexWithUV(16, 0.0, 0.0, (double)icon.getMaxU(), (double)icon.getMinV()); + tessellator.addVertexWithUV(0.0, 0.0, 0.0, icon.getMinU(), icon.getMinV()); + tessellator.addVertexWithUV(0.0, 16, 0.0, icon.getMinU(), icon.getMaxV()); + tessellator.addVertexWithUV(16, 16, 0.0, icon.getMaxU(), icon.getMaxV()); + tessellator.addVertexWithUV(16, 0.0, 0.0, icon.getMaxU(), icon.getMinV()); tessellator.draw(); //ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625f); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java index 5223ca5b5b..0d5347a87e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -88,8 +88,8 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity return new String[]{ CommonValues.TEC_MARK_EM, mDescription, - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowMax) + " eV/c\u00b2", - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowDisperse) + " (eV/c\u00b2)/s", + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowMax) + " "+translateToLocal("tt.keyword.unit.mass"), + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + TT_Utility.formatNumberShortExp(overflowDisperse) + " "+translateToLocal("tt.keyword.unit.massFlux"), translateToLocal("gt.blockmachines.hatch.emmuffler.desc.3") }; } @@ -217,10 +217,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity public String[] getInfoData() { return new String[]{ translateToLocalFormatted("tt.keyphrase.Contained_mass", clientLocale) + ":", - EnumChatFormatting.RED + TT_Utility.formatNumberExp(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + TT_Utility.formatNumberShortExp(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", + EnumChatFormatting.RED + TT_Utility.formatNumberExp(overflowMatter) + EnumChatFormatting.RESET + " "+translateToLocal("tt.keyword.unit.mass")+ " / ", + EnumChatFormatting.GREEN + TT_Utility.formatNumberShortExp(overflowMax) + EnumChatFormatting.RESET + " "+translateToLocal("tt.keyword.unit.mass"), translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + - EnumChatFormatting.BLUE + TT_Utility.formatNumberShortExp(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + EnumChatFormatting.BLUE + TT_Utility.formatNumberShortExp(overflowDisperse) + EnumChatFormatting.RESET + " "+translateToLocal("tt.keyword.unit.massFlux") }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index 474dbdab2c..12220dfe14 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -35,14 +35,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; -import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.util.TT_Utility.areBitsSet; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; @@ -56,10 +54,23 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; */ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - public static final int SCAN_DO_NOTHING = 0, - SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, - SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, - SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; + public static final int + SCAN_DO_NOTHING = 0, + SCAN_GET_NOMENCLATURE = 1<<0, + SCAN_GET_DEPTH_LEVEL = 1<<1, + SCAN_GET_AMOUNT = 1<<2, + SCAN_GET_CHARGE = 1<<3, + SCAN_GET_MASS = 1<<4, + SCAN_GET_ENERGY = 1<<5, + SCAN_GET_ENERGY_LEVEL = 1<<6, + SCAN_GET_TIMESPAN_INFO = 1<<7, + SCAN_GET_ENERGY_STATES = 1<<8, + SCAN_GET_COLORABLE = 1<<9, + SCAN_GET_COLOR_VALUE = 1<<10, + SCAN_GET_AGE = 1<<11, + SCAN_GET_TIMESPAN_MULT = 1<<12, + SCAN_GET_CLASS_TYPE = 1<<13, + SCAN_GET_TOO_BIG = 1<<14;//should be the sum of all flags +1 private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private EMDefinitionStack objectResearched; @@ -110,7 +121,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } v = (int) v; if (v == 0) return LedStatus.STATUS_NEUTRAL; - if (v >= SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; + if (v >= SCAN_GET_TOO_BIG) return LedStatus.STATUS_TOO_HIGH; if (v < 0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; @@ -148,58 +159,60 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private void addComputationRequirements(int depthPlus, int capabilities) { if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) { - computationRequired += depthPlus * 5L; + computationRequired += depthPlus * 3L; eRequiredData += depthPlus; } if (areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { computationRequired += depthPlus * 10L; eRequiredData += depthPlus; - } if (areBitsSet(SCAN_GET_AMOUNT, capabilities)) { computationRequired += depthPlus * 64L; eRequiredData += depthPlus * 8L; - } if (areBitsSet(SCAN_GET_CHARGE, capabilities)) { computationRequired += depthPlus * 128L; eRequiredData += depthPlus * 4L; - } if (areBitsSet(SCAN_GET_MASS, capabilities)) { computationRequired += depthPlus * 256L; eRequiredData += depthPlus * 4L; - + } + if (areBitsSet(SCAN_GET_ENERGY, capabilities)) { + computationRequired += depthPlus * 256L; + eRequiredData += depthPlus * 16L; } if (areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { - computationRequired += depthPlus * 512L; + computationRequired += depthPlus * 256L; eRequiredData += depthPlus * 16L; - } if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { computationRequired += depthPlus * 1024L; eRequiredData += depthPlus * 32L; - } if (areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { computationRequired += depthPlus * 2048L; eRequiredData += depthPlus * 32L; - } - if (areBitsSet(SCAN_GET_COLOR, capabilities)) { + if (areBitsSet(SCAN_GET_COLORABLE, capabilities)) { + computationRequired += depthPlus * 512L; + eRequiredData += depthPlus * 48L; + } + if (areBitsSet(SCAN_GET_COLOR_VALUE, capabilities)) { computationRequired += depthPlus * 1024L; eRequiredData += depthPlus * 48L; - } if (areBitsSet(SCAN_GET_AGE, capabilities)) { computationRequired += depthPlus * 2048L; eRequiredData += depthPlus * 64L; - } if (areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { computationRequired += depthPlus * 2048L; eRequiredData += depthPlus * 64L; - + } + if (areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + computationRequired += depthPlus * 2L; + eRequiredData += depthPlus; } } @@ -277,9 +290,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa for (int i = 0; i < 20; i++) { if (scanComplexityTemp[i] != SCAN_DO_NOTHING) { maxDepth = i; - if (!DEBUG_MODE) { - scanComplexityTemp[i] &= ~SCAN_GET_CLASS_TYPE; - } addComputationRequirements(i + 1, scanComplexityTemp[i]); } } @@ -311,7 +321,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa tNBT.setString("eMachineType", machineType); tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry)); - tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); + tNBT.setString("author", TEC_MARK_SHORT + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); } diff --git a/src/main/java/com/github/technus/tectech/util/CommonValues.java b/src/main/java/com/github/technus/tectech/util/CommonValues.java index f5d5ce6900..603644bcde 100644 --- a/src/main/java/com/github/technus/tectech/util/CommonValues.java +++ b/src/main/java/com/github/technus/tectech/util/CommonValues.java @@ -6,38 +6,33 @@ import net.minecraft.util.EnumChatFormatting; * Created by danie_000 on 11.01.2017. */ public final class CommonValues { - public static final String TEC_MARK_GENERAL = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Interdimensional"; - public static final String TEC_MARK_EM = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Elemental Matter"; - public static final String BASS_MARK = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Theta Movement"; - public static final String COSMIC_MARK = - EnumChatFormatting.BLUE + "Tec" + - EnumChatFormatting.DARK_BLUE + "Tech" + - EnumChatFormatting.BLUE + ": Cosmic";//TODO get a better name than cosmic for *UNDEFINED* thing + public static final String TEC_MARK_SHORT = + EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech"; + public static final String TEC_MARK_GENERAL = TEC_MARK_SHORT + + EnumChatFormatting.BLUE + ": Interdimensional"; + public static final String TEC_MARK_EM = TEC_MARK_SHORT + + EnumChatFormatting.BLUE + ": Elemental Matter"; + public static final String BASS_MARK = TEC_MARK_SHORT + + EnumChatFormatting.BLUE + ": Theta Movement"; + public static final String COSMIC_MARK = TEC_MARK_SHORT + + EnumChatFormatting.BLUE + ": Cosmic";//TODO get a better name than cosmic for *UNDEFINED* thing - public static final byte DECAY_AT = 0;// hatches compute decays + public static final byte DECAY_AT = 0;// hatches compute decays public static final byte MULTI_PURGE_1_AT = 2;// multiblocks clean their hatches 1 - public static final byte MOVE_AT = 4;// move stuff around - public static final byte RECIPE_AT = 6;// move stuff around + public static final byte MOVE_AT = 4;// move stuff around + public static final byte RECIPE_AT = 6;// move stuff around public static final byte MULTI_PURGE_2_AT = 8;// multiblocks clean their hatches 2 - public static final byte OVERFLOW_AT = 10;// then hatches clean themselves + public static final byte OVERFLOW_AT = 10;// then hatches clean themselves // - in case some hatches are not in multiblock structure - public static final byte MULTI_CHECK_AT = 12;// multiblock checks it's state - public static final byte DISPERSE_AT = 14;// overflow hatches perform disperse - public static final byte TRANSFER_AT = 16; + public static final byte MULTI_CHECK_AT = 12;// multiblock checks it's state + public static final byte DISPERSE_AT = 14;// overflow hatches perform disperse + public static final byte TRANSFER_AT = 16; - public static final long[] AatV = new long[]{268435455,67108863,16777215,4194303,1048575,262143,65535,16383,4095,1023,255,63,15,3,1,1}; + public static final long[] AatV = new long[]{268435455, 67108863, 16777215, 4194303, 1048575, 262143, 65535, 16383, 4095, 1023, 255, 63, 15, 3, 1, 1}; public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", "Ultimate High Voltage", "Ultimate Extreme Voltage", "Ultimate Insane Voltage", "Ultimate Mega Voltage", "Ultimate Extended Mega Voltage", "Overpowered Voltage", "Maximum Voltage"}; - public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UMV", "UXV", "OpV", "MAX"}; - public static final long[] V = new long[]{8L, 32L, 128L, 512L, 2048L, 8192L, 32768L, 131072L, 524288L, 2097152L, 8388608L, 33554432L, 134217728L, 536870912L, 1073741824L, Integer.MAX_VALUE - 7}; + public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UMV", "UXV", "OpV", "MAX"}; + public static final long[] V = new long[]{8L, 32L, 128L, 512L, 2048L, 8192L, 32768L, 131072L, 524288L, 2097152L, 8388608L, 33554432L, 134217728L, 536870912L, 1073741824L, Integer.MAX_VALUE - 7}; - private CommonValues() {} + private CommonValues() { + } } diff --git a/src/main/java/com/github/technus/tectech/util/TT_Utility.java b/src/main/java/com/github/technus/tectech/util/TT_Utility.java index c989fe1e1f..a9732e294a 100644 --- a/src/main/java/com/github/technus/tectech/util/TT_Utility.java +++ b/src/main/java/com/github/technus/tectech/util/TT_Utility.java @@ -29,9 +29,11 @@ import org.apache.commons.lang3.StringUtils; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.lang.reflect.Array; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.function.Function; /** * Created by Tec on 21.03.2017. @@ -39,10 +41,12 @@ import java.util.*; public final class TT_Utility { private TT_Utility() { } - private static final Map formaters=new HashMap<>(); + private static final StringBuilder STRING_BUILDER =new StringBuilder(); + private static final Map FORMATTER_MAP =new HashMap<>(); private static Formatter getFormatter(){ - return formaters.computeIfAbsent(Locale.getDefault(Locale.Category.FORMAT), Formatter::new); + STRING_BUILDER.setLength(0); + return FORMATTER_MAP.computeIfAbsent(Locale.getDefault(Locale.Category.FORMAT), locale -> new Formatter(STRING_BUILDER,locale)); } public static String formatNumberShortExp(double value){ @@ -305,7 +309,7 @@ public final class TT_Utility { return strings; } - public static String[] infoFromNBT(NBTTagCompound nbt) { + public static String[] unpackStrings(NBTTagCompound nbt) { String[] strings = new String[nbt.getInteger("i")]; for (int i = 0; i < strings.length; i++) { strings[i] = nbt.getString(Integer.toString(i)); @@ -313,6 +317,37 @@ public final class TT_Utility { return strings; } + public static String getSomeString(NBTTagCompound nbt,int index) { + return nbt.getString(Integer.toString(index%nbt.getInteger("i"))); + } + + public static NBTTagCompound packStrings(String... info) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + @SuppressWarnings("unchecked") + public static T[] unpackNBT(Class tClass, Function converter, NBTTagCompound nbt) { + T[] objects = (T[])Array.newInstance(tClass,nbt.getInteger("i")); + for (int i = 0; i < objects.length; i++) { + objects[i] = converter.apply(nbt.getCompoundTag(Integer.toString(i))); + } + return objects; + } + + public static NBTTagCompound packNBT(Function converter, T... info) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setTag(Integer.toString(i), converter.apply(info[i])); + } + return nbt; + } + public static boolean areBitsSet(int setBits, int testedValue) { return (testedValue & setBits) == setBits; } diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index f9ab756696..471b0f1062 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -799,16 +799,9 @@ gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front tt.keyword.ID=ID #Example: 32EU at 1A tt.keyword.at=at -#EM scan result -tt.keyword.CLASS=CLASS -tt.keyword.NAME=NAME -tt.keyword.CHARGE=CHARGE -tt.keyword.COLORLESS=COLORLESS -tt.keyword.MASS=MASS -tt.keyphrase.LIFE_TIME=LIFE TIME -tt.keyphrase.CARRIES_COLOR=CARRIES COLOR + tt.keyphrase.Hint_Details=Hint Details -tt.keyphrase.At_current_energy_level=At current energy level + #debug boom tt.keyword.BOOM=BOOM! tt.keyword.Destination=Destination @@ -871,11 +864,48 @@ tt.keyphrase.Ass_line_recipe=Assembly Line Recipe tile.turretHeadEM.name=Elemental Matter Turret tile.turretBaseEM.name=Elemental Turret Base -tt.keyword.mol=mol -tt.keyword.itemMols=items -tt.keyword.mbMols=mb +#EM scan result +tt.keyword.scan.depth=Depth +tt.keyword.scan.class=Class +tt.keyword.scan.name=Name +tt.keyword.scan.symbol=Symbol + +tt.keyword.scan.mass=Mass +tt.keyword.scan.count=Count +tt.keyword.scan.amount=Amount +tt.keyword.scan.energy=Energy +tt.keyword.scan.energyLevel=Energy Level +tt.keyword.scan.charge=Charge +tt.keyword.scan.life_mult=Life multiplier +tt.keyword.scan.half_life=Half life +tt.keyword.scan.life_time=Life time +tt.keyword.scan.age=Age +tt.keyphrase.scan.at_current_energy_level=At current energy level +tt.keyword.scan.color=Colorless +tt.keyword.scan.colorless=Colorless +tt.keyword.scan.colored=Colored + +tt.keyword.short.mass=M +tt.keyword.short.count=Qty +tt.keyword.short.amount=Qty +tt.keyword.short.energy=E +tt.keyword.short.energyLevel=EL +tt.keyword.short.charge=C +tt.keyword.short.time=T + +tt.keyword.unit.mass=eV/c² +tt.keyword.unit.massFlux=eV/c²s +tt.keyword.unit.count= +tt.keyword.unit.mol=mol +tt.keyword.unit.itemMols=item(s) +tt.keyword.unit.mbMols=mb +tt.keyword.unit.energy=eV +tt.keyword.unit.charge=e +tt.keyword.unit.time=s +tt.keyword.unit.tick=t #that the thing wont decay tt.keyword.stable=STABLE + #EM types tt.keyword.Primitive=Primitive tt.keyword.Element=Element -- cgit