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 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